Suddenly having db connection issues

August 29, 2016 108 views

Hi there,

Wonder if I can get any assistance. My WordPress install suddenly is showing:

Error establishing a database connection

I've created a test file to check the connection and it returns this error:

Could not connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

We're using the usual "localhost" as host. Any suggestions? I'm trying to figure it out.

With thanks,

1 Answer

Here are the next steps I would take in this situation.

1.) Review your MySQL logs in /var/log/mysql. If they refer to running out of memory, create a swap file and/or upgrade to a larger droplet.

2.) Restart your MySQL service with the command service mysql restart.

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. <$>[warning] [label...
Have another answer? Share your knowledge.