1. Stop the MySQL database server:
sudo /etc/init.d/mysql stop
2. Create the directory that will be the new datadir:
sudo mkdir /home/db
3. Change ownership of the new folder to the mysql user and group:
sudo chown -R mysql:mysql /home/db
4. Edit /etc/mysql/my.cnf
sudo nano /etc/mysql/my.cnf
to change the datadir value to the new value /home/db : 5. Copy all files except those named ib_arch_log_0000000000, ib_logfile0 etc from old datadir to the new folder.6. Set ownership of new data folder and its files:
sudo chown -R mysql:mysql /home/db/*
7. Repeat steps 2-7 for innodb_data_home_dir if you are changing it too. 8. Restart the MySQL database server:
sudo /etc/init.d/mysql start
|