Can't create/write to file '/tmp/#sql_1f98_0.MYI' (Errcode: 28)

Posted February 28, 2018 26.1k views

Hi, our Wordpress installation is getting this issue and returning this message:

Can’t create/write to file ’/tmp/#sql1f980.MYI’ (Errcode: 28)

Can someone help with this?

Kind regards

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
4 answers

It is most probably the system is ran out of inodes. In my case PHP sessions are the issue. Check the inodes by run df -i
Solution :
rm -rf /var/lib/php/sessions/
mkdir /var/lib/php/sessions/ && chmod 1733 /var/lib/php/sessions/
Another reference:

By default the /tmp directory is writable by all and files in this directory are usually deleted on reboot. This error could indicate one of the following:

  • Somehow permissions on this file or on your /tmp directory were changed and the MySQL process no longer has permission to write the file it needs.
  • For some reason the service is being blocked from writing to the file, possible if there is an existing process already running.
  • Your disk has run out of space preventing the service from writing the file it needs.

I would recommend first rebooting your droplet. This should clear most if not all of the contents of /tmp and get rid of any hanging processes. If this does not resolve the issue, make sure the permissions and ownership of /tmp is correct.

  • can i reboot droplet from Digital Ocean control panel or do I need to do that from console terminal?

    • You can do so from the control panel. The reboot function there will attempt to do a soft reboot (the same as using the reboot command in the console). If the droplet fails to respond to the soft reboot after 5 minutes the system will force a hard reboot (like flipping the power switch on your computer).

Hello i’ve got the same issue we can’t connect to the database anymore;

The same problem, my case was out of disk, I rebooted and it worked fine.