mysql mv /var/lib/mysql to a new folder

after mv /var/lib/mysql to new directory such as /home/mysql

I had to 

mkdir /var/lib/mysql

mount --bind /home/mysql /var/lib/mysql

chown -R mysql:mysql /var/lib/mysql

chmod 755 /var/lib/mysql

then restart the mariadb, it works

if using

ln /home/mysql /var/lib/mysql

mariadb cannot be restarted

so, do not use ln to make a symblink for the moved mysql directory, but make it with the mount command as mentioned above.

then, make the neccessary permissions mentioned above.

reference:

https://dba.stackexchange.com/questions/106085/cant-create-file-var-lib…;

留学咨询专家王觉菊老师
分类