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,
Marc

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.

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

by Justin Ellingwood
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...
Submit an Answer