Sunday, May 22, 2011

"SQL Error: 13: Can't create/write to file" on other then /tmp directories (apparmor)

If you get SQL Error: 13 after changing tmpdir parameter in you my.cnf first check permissions in a new directory. If permissions are correct you might be having an issue with AppArmor. AppArmor is a GNU security module for the Linux kernel and it might prevent MySQL from writing to the new directory.
Run: aa-status
To verify if it`s on. If so you will get something like:
profiles are loaded
profiles are in enforce mode
Edit this file:
and append your new temp directory in the end.
/usr/sbin/mysqld {
/new_tmp/ r,
/new_tmp/* rw,
Reload AppArmor with:
/etc/init.d/apparmor reload
Thats it.

No comments: