Can't create/write to file '/tmp/#sql_xxxx.MYI' (Errcode: 13)
I have installed Debian Lenny, PHPmyadmin and postfix.
When using PHPmyadmin GUI and access any table with data i get:
Can't create/write to file '/tmp/#sql_xxxx.MYI' (Errcode: 13)
doing perror 13 says:
OS error code 13: Permission denied
I find the tmpdir lik so:
mysqladmin -p variables | grep -w tmpdir
| tmpdir | /tmp
Now that means that mysql cannot write to /tmp. Making the permissions to :777 fixes that. But I doesn't feel right I have to do that. Is there a better way/fix?
Should I change the value tmpdir in /etc/mysql/my.cnf
?
Solution 1:
It looks like your permissions on /tmp are wrong. They really should be read/write/execute for everyone with the sticky bit set.
chmod 1777 /tmp
The sticky bit add some restrictions to how other users interact with files not created or owned by them, so there's no reason to worry.
If you wish, you may also create a seperate directory owned and writeable by the mysql user and specify that directory in my.cnf to be used instead of the system wide /tmp.
Solution 2:
Normaly the /tmp directory is writeable for everyone. You shouldn't be concerned about this. Additional the sticky bit is set so only root and the owner of a file can delete that file.
chmod 777 /tmp chmod o+t /tmp
Have a nice day