Wednesday, January 13, 2010

MySQL: Changing data directory on Ubuntu 9.04

You would think it is a pretty easy task to go to the /etc/mysql/my.cnf file and change the datadir to the new directory, then restart MySQL. However, MySQL will fail every time you restart it. There are a couple of considerations to make when you do this change:

1- Make a copy of all databases to the new directory.
2- Change the datadir configuration on /etc/
3- Change /etc/apparmor.d/usr.sbin.mysqld so the old data dir is no longer there.
4- Reload Apparmor daemon.
5- Verify ownership and pem on new data dir.
6- Restart MySQL

You can follow this blog for more detailed instructions.

Enjoy it...

1 comment: