Moving MySQL Database Files on Ubuntu Hardy

I wanted to move my /var/lib/mysql directory to /data/mysql (a new partition). So I copied them and made the appropriate change in /etc/my.cnf. On restarting mysql with /etc/init.d/mysql start, I got a failure.

On looking in the /var/log/messages file, I found:

Nov 23 17:48:46 carpenomen kernel: [ 2714.258037] audit(1227462526.718:13): type=1503 operation="inode_create" requested_mask="w::" denied_mask="w::" name="/data/mysql/carpenomen.lower-test" pid=19659 profile="/usr/sbin/mysqld" namespace="default"
Nov 23 17:48:46 carpenomen kernel: [ 2714.310572] audit(1227462526.770:14): type=1503 operation="inode_permission" requested_mask="rw::" denied_mask="rw::" name="/data/mysql/ibdata1" pid=19659 profile="/usr/sbin/mysqld" namespace="default"

A lot of head scratching and a search on google led me to this article:

http://www.ubuntu-howto.info/h...

The most important last 'trick' is to update and restart apparmor:

vi /etc/apparmor.d/usr.sbin.mysqld

and change the lines which mention the mysql datafile and then restart apparmor and mysql...

# /etc/init.d/apparmor restart
Reloading AppArmor profiles : done.
# /etc/init.d/mysql start
* Starting MySQL database server mysqld                                 [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.

This site uses cookies. Continue to use the site as normal if you are happy with this, or read more about cookies and how to manage them.

X