- Stop MySQL server:
- I have completed the instructions below as root user - Create the new database directory:
- Modify the MySQL configuration file to point to the new database directory:
#and change to: datadir = /mnt/data/db/mysql
- Change usr.sbin.mysqld file to reflect the new database directory:
#and change from
/var/lib/mysql/ r,
/var/lib/mysql/** rwk,
to
/mnt/data/db/mysql/ r,
/mnt/data/db/mysql/** rwk,
#and run
/etc/init.d/apparmor restart
- Initialize the new database directory:
#change permissions as necessary
chown -R mysql:mysql /mnt/data/db/mysql
chmod -R 700 /mnt/data/db/mysql
- Start MySQL server:
It is done!
You can change the new database directory to any directory of your choice, just modify the commands above to reflect it.
If you get "Access denied for user 'root'@'localhost'" after changes above, then run the following to update MySQL root user password:
sudo dpkg-reconfigure mysql-server-5.5
Thanks!
ReplyDelete