View Full Version : [ubuntu] Moving MySQL DB to Secondary Partition

August 12th, 2009, 07:52 PM
I've successfully installed the latest versions of Ubuntu Server and Drupal on a server with two RAID 1 arrays. Everything is installed & configured on the primary array. Before I go to work on the Drupal configuration, I want to move the MySQL database over to the secondary array. I tried doing so by following these instructions:


I hit the end where I attempt to restart MySQL, but all I get is a response "fail". No error code or other notification. I can modify the "my.cnf" file to restart MySQL from the primary array no problem, but can't get it to work from the secondary.

I've also tried copying the entire MySQL folder to the new location, with the same results.

I presume it's a permissions issue, but I'm not familiar enough with Linux or MySQL to identify the problem.

Thanks in advance for any assistance!

August 12th, 2009, 08:02 PM
Ubuntu installs mysql-server with an apparmor profile,


This apparmor profile restricts the directories into which mysql can read/write. In order for mysqld to read /path/to/secondary/array/DATABASE you must edit /etc/apparmor.d/usr.sbin.mysqld by adding lines like this:

/path/to/secondary/array/DATABASE/ r,
/path/to/secondary/array/DATABASE/** rwk,

After you edit /etc/apparmor.d/usr.sbin.mysqld, you may also need to restart the mysqld server and maybe also apparmor:

sudo /etc/init.d/apparmor restart
sudo /etc/init.d/mysql restart

PS. On the web page you referenced,
Don on August 15, 2008 mentions a little about this issue. You may also find more info about apparmor here: http://ubuntuforums.org/showthread.php?p=6353900#post6353900

August 12th, 2009, 08:18 PM
Thanks so much unutbu - I completely missed the additional comments at the end of that link which covered the issue. That said, your help with the straightforward commands made life very easy! I did end up needing to reboot the entire server, but once I did that, everything was as I wanted it.