How to move MySQL to second drive

If you ran out of space in your primary drive and wish to move MySQL to another drive then here is a simple procedure. Moving MySQL to another drive is very easy then it look.

1) Find out mount point of secondary drive.  If drive is not mounted yet then you can get help from article “How to mount drive in CentOS”

You can run below command to find mount point of secondary drive

It could be /dev/hdb or /dev/sdb and mount to (let suppose) /mydisk2

2) Stop Myqsl using command

3) Move MySQL files to second drive

4) set permission on new mysql directory

5) remove or rename old mysql

6) Once data is moved to second drive, just create a symlink to it

7) Now your data is moved, we will make changes in configuration file

8 ) Comment old line and add new

Save and exit

9) Start MySQL

Thats all !!

Please follow and like us:
About shk

shk is a DevOps engineer with more than 12 years of experience in different organizations. He enthusiastic about learning new technologies and shares his knowledge through his blogs.


  1. Thank you!

Comment Policy:

Your words are your own, so be nice and helpful if you can. Please, only use your real name, not your business name or keywords. Using business name or keywords instead of your real name will lead to the comment being deleted. Anonymous commenting is not allowed either. Limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.

Tell us what you're thinking...

All comments are moderated.

* Denotes required field.



Previous Post:
Next Post: