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.

  • 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: pastebin.com/hGx6tuka – Keyo Nov 8 '10 at 5:44

Sounds like a full /tmp to me

Or a permissions problem..

  • 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?

  • 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.

Your Answer

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

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