I have installed wordpress theme and I am getting an error.

I have installed wordpress theme and I am getting an error. This is not a constant error. Error appears, then it appears as normal and repeats.

“error establishing a database connection”

Why? please check.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Hi @ssillookboy,

Usually, when you experience such an error it’s related to your MySQL application. Most probably your MySQL is getting killed for some reason, either because it can’t handle the traffic or your Droplet is having high load.

When this happens I recommend SSHing to your Droplet and checking if MySQL is actually running.

sudo netstat -plt

The netstat command prints information about our server’s networking system. In this case, you want the names of programs (-p) listening for connections (-l) on a tcp socket (-t). Check the output for a line listing mysqld.

If you find it, you’ll know MySQL is running, if you don’t, then you can start it with:

systemctl start mysql

As mentioned for further debugging you can try and see:

Another thing you can try is to add SWAP to your Droplet. Swap is a portion of hard drive storage that has been set aside for the operating system to temporarily store data that it can no longer hold in RAM. This lets you increase the amount of information that your server can keep in its working memory, with some caveats. The swap space on the hard drive will be used mainly when there is no longer sufficient space in RAM to hold in-use application data.

Hello, @ssillookboy

Can you confirm if the MySQL service is running at the moment? To check run:

  1. sudo systemctl status mysql

You can also check our article on How To Debug the WordPress “Error Establishing Database Connection

Regards, Alex