Report this

What is the reason for this report?

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

Posted on March 6, 2015

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.



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!

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 why does this seem to be a continuous problem for wordpress installs on DO? I haven’t seen this issue across other hosts

@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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.