Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
Can't create/write to file '/tmp/#sql_77a8_0.MYD' (Errcode: 17)

I'm getting this for all softs of select queries. This problem is quite intermittent. Deleting the file fixes the problem but in an hour or so it's back again.

Trying to restart the service occationally gives this error:

[14:57] root@host [/home/belntwk/all_sites]# service mysql restart
Shutting down MySQL. ERROR! Manager of pid-file quit without updating file.
 ERROR! Failed to stop running server, so refusing to try to start.

No idea what the problem is or even how to test if it has been fixed or not.

share|improve this question
I should note that the /tmp folder is chmod 777 and there is ample disk space. – Keyo Nov 8 '10 at 4:16
Here is a dump of mysql variables: – Keyo Nov 8 '10 at 5:44

Sounds like a full /tmp to me

Or a permissions problem..

share|improve this answer
NB the /tmp filesystem should have the other sticky bit set (drwxrwxrwt) – symcbean Nov 8 '10 at 9:31

Just do a killall mysqld.

For the real cause..... is your disk (or /tmp) full?

share|improve this answer
Nope, 400MB free. – Keyo Nov 8 '10 at 4:16
grep /var/log/messages for SELinux. -- is SELinux blocking your mysqld? You should see message like SELinux is preventing mysqld (something) – J-16 SDiZ Nov 8 '10 at 4:35
No occurrences of 'SELinux'. – Keyo Nov 8 '10 at 5:35

The temporary file "#sql_272_0.MYD" cannot be written to because it was not removed from a past session and unwrittable by the current session. It needs to be manually removed from the /tmp directory.

ssh into your server using the terminal, and enter the following command:

rm -f "/tmp/#sql_272_0.MYD"

Edit: make sure to execute the command as a user with permission to delete the file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.