SQL error log can’t create/write to file

permissionssql

I'm quite new to server administration but a keen learner, so if I miss anything or you need any extra info let me know and I'll do my best to provide it ASAP 🙂

I'm running WordPress on a developer plan VPS over at media temple (meaning I have root access, everything is managed by me etc). My OS is Fedora, Apache is latest version and am using MariaDB for MySQL.

When trying to read/write menus from the WP admin panel Apache writes this to its error log:

[Fri Dec 13 04:28:59.296672 2013] [:error] [pid 11195] [client (my IP, omitted)] WordPress database error Can't create/write to file '/var/tmp/#sql_1ff_0.MAI' (Errcode: 2) for query (**lots of different queries**)

This error repeats for about 20 different queries, and I've checked with perror that error code 2 for SQL means "No such file or directory".

I would contact my host about this problem, but as I said I'm on a developer plan meaning they won't help me with anything. Generally from Googling around I can find an answer or solution but in this case I've come up with nothing.

Best Answer

You can use the perror command to get an explanation on system errors:

~]$ perror 2
OS error code   2:  No such file or directory

It may be that the directory /var/tmp/ does not exist.

Alternatively the WordPress MySQL user may not have been granted sufficient permissions to create files. You may need to GRANT FILE and/or CREATE TEMPORARY TABLES priviliges to the WordPress user. Refer to the the GRANT manual page.

Related Topic