CentOS 6.4 – help with MySQL on another drive

CentOS 6.4 – help with MySQL on another drive

Postby TrevorH » 2013/09/06 08:47:09

I haven’t read the article you are following but changing the default mysql data directory will get you into issues with selinux. The best thing to do is to

Create a new LVM Logical Volume of the required size
Format it with your intended filesystem
Stop mysql
Move /var/lib/mysql to /var/lib/oldmmysql
Create a new /var/lib/mysql directory
Add a line to /etc/fstab to mount your new LV on /var/lib/mysql
Run `mount -a` to mount the new /var/lib/mysql
Set the permissions on the newly mounted filesystem to the same as on /var/lib/oldmysql
Run `restorecon -r /var/lib/mysql`
Copy the data from /var/lib/oldmysql to /var/lib/mysql
Restart the mysql daemon

Once you are sure it all works as intended, remove /var/lib/oldmysql.