Here are the steps to move mysql data directory to home directory
Code:
ln -s /home/var_mysql/mysql /var/lib/mysql
1. Make a full mysqldump file:
Code:
mysqldump --all-databases | gzip > /home/alldatabases.sql.gz
3. Stop MySQL
Code:
/etc/init.d/mysql stop
Code:
mkdir /home/var_mysql mv /var/lib/mysql /home/var_mysql chown -R mysql:mysql /home/var_mysql/mysql ln -s /home/var_mysql/mysql /var/lib/mysql /etc/init.d/mysql start
If anything goes wrong, you have the full mysqldump backup, and can use these steps to restore from it:
First, you'll need the MySQL root password:
Code:
cat /root/.my.cnf
Code:
gunzip < /home/alldatabases.sql.gz | mysql -u root -p
After you are done with this movement. Restart CageFS as localhost won't work and 127.0.0.1 will work if you don't do so.
You might need to remove users from CageFS and re-enable them.
0 Comments