Move a MySQL database – How To
I had to move one of my databases from the main OS drive to a different partition. Being that I’ve not administered my own mysql database before — nothing beyond SQL level administration — I needed to find some sort of guide. I found the following and was quite pleased; I thought that other might be able to use this.
How to move MySql database to another drive or partition.
While this post is not strictly about the internal workings of an open source software package, it does have to do with the administration of notable open source software and hence, worth this blog’s posting.
The one thing to note is that the instructions seem out of date. The instructions were written using Ubuntu Server 7.10 (Gutsy Gibbon) as a basis. The instructions worked for me except for the apparmor note below. I’m currently using Ubuntu Server 8.04 LTS.
You many need to modify apparmor’s configuration file and then restart the service. You can see the conversation in the comments (on the article) about it, but the brief version of it is:
- Complete the main instructions first (Understand the entire article before starting.)
- Open
nano /etc/apparmor.d/usr.sbin.mysqld - Modify entries pointing to the old location to point to then new location. This will look like:
/var/www/mysql_datadir/ r, /var/www/mysql_datadir/** rwk, - Restart apparmor which can be done via:
/etc/init.d/apparmor restart
Again, the full article is: How to move MySql database to another drive or partition.

Recent Comments