I'm running MySQL 5.6.30 - MySQL Community Server (GPL) on ubuntu-16.04-x86_64 and I'm using phpMyAdmin 4.7.7.

Sometimes, without doing anything on the Server or phpMyAdmin, I'm getting this error message on my websites:

Connection failed: SQLSTATE[HY000] [2002] Connection refused

When trying to log in into phpMyAdmin I'm getting these four error messages:

#2002 - No such file or directory – The server is not responding (or the local server's socket is not correctly configured).


mysqli_real_connect(): (HY000/2002): No such file or directory


Connection for controluser as defined in your configuration failed.


mysqli_real_connect(): (HY000/2002): No such file or directory

After making a reboot everything is working fine as normal, there are no error messages any more and I'm able to login into phpMyAdmin.

Why does it happen? Any ideas?

  • Last time I've tried something like this, is turned out to be as simple as a "no more disk space" :/ So next time it's occur I'll suggest you do a "df -sh" on your tmp drive PS: As this isn't an exact answer, I've would have added it as a comment, but not allowed to – Joakim Dec 31 '17 at 10:51
  • It is likely to be a failed or failing disk on the server. Check /var/log/messages for any errors. – Simon Greenwood Dec 31 '17 at 10:51

Any ideas?

  • Search is your friend.

  • As per What Causes the 'Connection Refused' message ?, it seems likely that nothing is listening. We can deduce that MySQL has likely stopped working.

  • Examine your system and mysql logs to find relevant messages and understand the issue.

I will take a wild guess and suggest that the OOM killer is killing MySQL because your system is running out of memory. I could be wildly wring though, it could be cosmic rays or disc space or something completely different.

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.