The inability of mysql to write tmp files is apparently not that uncommon, but in my situation it seems like the permissions required should already be in place, so I'm wondering why mysql can't access it's tmp file location.

Just to make sure I'm clear that we're not talking about that also-not-uncommon apparmor permission problems here are the error message I'm getting:

/usr/sbin/mysqld: Can't create/write to file '/var/lib/mysqltmp/ib70AjJD' (Errcode: 13)
161031  0:20:12  InnoDB: Error: unable to create temporary file; errno: 13

I've already looked at the following possible solutions:

What seems to be different about my situation is that the permissions to mysql's tmp directory seem to be correct, and if I switch the directory to /tmp instead, with seeming identical permissions, everything works fine.

Permissions for /var/lib/mysqltmp (the original config value; fails):

drwxrwxrwt 2 mysql   mysql   12288 Oct 30 23:44 mysqltmp/

Permissions for /tmp (updated by me; works):

drwxrwxrwt   5 root root  4096 Oct 31 09:44 tmp/

MySQL 5.5.53 is running as user mysql. Obviously the owners of the two directories are different, but given those directory permissions that shouldn't be relevant, right? What's making this work using /tmp but not var/lib/mysqltmp?

  • "we're not talking about that also-not-uncommon apparmor permission problems" but with error 13, it could still be apparmor, and when nothing else makes sense... as seems to be the case, here. Permissions seem usable. Are you running apparmor? The only other thought also seems pretty unlikely: you might see this if /var/lib/mysqltmp is on a filesystem that has encountered an error and is now mounted read-only. Can you write to that directory? – Michael - sqlbot Oct 31 '16 at 22:10
  • Well it looks like it might be apparmor indeed. To answer your questions I am running apparmor, and yes I can write to that directory as user mysql. I was expecting logs in the mysql error log that would reflect apparmor, but looking in syslog I see some apparmor DENIED log entries for the directory, so that's probably the issue, thanks! – cori Nov 1 '16 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.