One thing I frequently forget when changing the default directories for various services in Ubuntu is that the AppArmor config for those services also needs to be updated. Case in point, the other day I needed to change MySQL's tmpdir to a different disk, and struggled for a while with "Can't create/write to file 'xyz' (Errcode: 13)" errors until I remembered AppArmor. These were the steps I ended up taking:
Create the new tmpdir
mkdir /mnt/foo/tmp && sudo chown mysql:mysql /mnt/foo/tmp
Change /etc/mysql/my.cnf to use the new tmpdir
tmpdir = /mnt/foo/tmp
Add new tmpdir entries to /etc/apparmor.d/local/usr.sbin.mysqld
/mnt/foo/tmp/ r, /mnt/foo/tmp/** rw,
Reload AppArmor
sudo service apparmor reload
Restart MySQL
sudo service mysql restart
While I was troubleshooting, I found a nice, in-depth blog entry by Jeremy Smyth explaining how to debug issues with AppArmor and MySQL.
dude, that's a 5 stars from me thanks!
ReplyDelete