Why do I often get this error when accessing phpmyadmin?

October 3, 2016 151 views
PHP MySQL WordPress LAMP Stack Apache Ubuntu 16.04

Hello everyone,

I have a VM from DO, and my distro is Ubuntu 16.04. I have the following software installed:
Apache2: 2.4.18
php: 5.6.26
mysql: 5.7.15
phpmyadmin: 4.5.4

I often get this error message on my wordpress site:

Error Establishing a Database Connection

So when I go to check my phpmyadmin and I try to log in I get the following error messages:

This above the login form

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

and this under the login form

Connection for controluser as defined in your configuration failed.

Here a screenshot for better illustration
phpMyadmin Screenshot

What I have done till now is always restarting my vm to get rid off that problem:

sudo reboot

After rebooting I am able to use my wordpress and phpmyadmin normally without any errors!

But I believe there is a better solution! It's really frustrating to get that error randomly!
Please help me.


1 Answer

What is your droplet size?
One of possibilities is that MySQL servers gets killed for some reason. For example that can be due to sufficient memory.
For beginning I would verify syslog for Out Of Memory killer logs.
Open /var/log/syslog with your favorite text editor:

  • nano /var/log/syslog

Look thought it and if you see Out of memory killer logs.
If you see any OOM messages there, that means your droplet needs more memory to run killed process (e.g. MySQL).
In that case, I can recommend adding Swap to your droplet or resizing it to bigger one.
If this is not the case, we can try looking for MySQL logs, but this is what I would first check. :)

One of the easiest way of increasing the responsiveness of your server and guarding against out of memory errors in your applications is to add some swap space. In this guide, we will cover how to add a swap file to an Ubuntu 16.04 server. &lt;$&gt;[warning] [label...
  • Hi,

    Thanks for your answer. I have checked the log file, but I didn't find any rows related to OOM. I have added this morning a swap partition to my droplet.

    I have 512MB ram droplet.

Have another answer? Share your knowledge.