Question

How to solve Mysql database connection error frequently after wordpress installation?

Recently I have purchased vps and after installing a website on wordpress frequenly I am getting an error about mysql database connection error. Each and every time I need to reboot my server, this is not feasible.

Subscribe
Share

It is a common error in wordpress plugin with outdated DO force this all updated.


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

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.

The most common reason for this issue is that your MySQL process is exhausting the RAM your droplet has available. This then causes the service to crash. There are three steps you can take to resolve this:

1.) Set up a swap file on your droplet. This should prevent the crashes. 2.) Upgrade to a larger droplet with more RAM available. 3.) Optimize your MySQL and other services.

@ryanpq I just enabled a swapfile on one of my droplets. Since the error seems to occur randomly (not at times of high load) I’m not sure if doing this made a difference or not. Is there a way to stress test the effectiveness of an enabled swapfile? Thanks

@ryanpq why does this seem to be a continuous problem for wordpress installs on DO? I haven’t seen this issue across other hosts