sudo aa-status
If mysqld is included in enforce mode
when AppArmor blocks the writes/accesses. What you can do is edit
/etc/apparmor.d/usr.sbin.mysqld
near the bottom like so:
...
/usr/sbin/mysqld { ... /var/log/mysql/ r, /var/log/mysql/* rw, /var/run/mysqld/mysqld.pid w, /var/run/mysqld/mysqld.sock w, /data/ r, /data/* rw,}And then make AppArmor reload the profiles.
# sudo /etc/init.d/apparmor reload