Moving mysql to a different partition – Ubuntu 12.04
- March 21st, 2016
- Write comment
I needed to move my MySQL databases to a different partition, since I was outgrowing the space. I created new space and used a mv command to move the files and preserve the permissions. I moved them to /mysql.
I set the permissions for the new directory:
chown mysql.mysql /mysql
chmod 700 /mysql
Then, I needed to modify the /etc/apparmor.d/tunables/alias file. Note: It is actually documented in the alias file for MySQL.
# vi /etc/apparmor.d/tunables/alias
…
alias /var/lib/mysql/ -> /mysql/,
# service apparmor restart
# service mysql start