I am using CentOS with cPanel. On my server, all MySQL databases save at /var/lib/mysql
. Now /var
is 100% full and MySQL has stopped working. How can I move the databases to a new directory like /home/mysql
especially considering that this server is managed with cPanel?
Centos – How to change the MySQL database directory
centosMySQL
Related Topic
- Mysql – restoring theisam thesql db on a different machine
- Centos – Are MySQL databases always stored in /var on CentOS
- MySQL Removal – Does Removing MySQL with yum Remove the Data?
- Linux – Access denied to thesql cause by invalid server hostname bind address
- CentOS running CPanel ran out of space, cannot start thesql or thesqld
Best Answer
I can't confirm this from cpanel, as I don't have access, but this is an example from the console connected by ssh and sudo to root. There are arguments for using a bind entry in /etc/fstab instead of a symlink, but this works for me.
My normal procedure is to stop mysql, move the directory contents, link the original, and restart mysqld.
I just noticed a similar question, of which this is close to a duplicate of, which mentions some issues of doing that above with selinux enabled; http://crashmag.net/change-the-default-mysql-data-directory-with-selinux-enabled
So if you have selinux there are some additional steps.