Random WordPress "Errorr Establishing Database Connection" errors, every 1-2 days

Posted November 17, 2018 1.4k views
MySQLWordPressUbuntu 18.04Databases

My Wordpress website is going offline every 1-2 days, with this error. The site was built using EasyEngine 3.

Looking at the stats, just before this happens I get a jump in Disk I/O reads from virtually 0 MB/s to about 0.89MB/s

Can anyone give me a few tips in order to effectively troubleshoot this, e.g what are the best logs to check (MySQL) etc?

This has been happening for a couple of weeks.

Many Thanks

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.

Submit an Answer
2 answers

Hey friend,

I would recommend logging in to the web console in our control panel. Click in the black area, press Enter to bring the display up. I’m expecting you to see out of memory process kills. Here’s an example of what that looks like:

What this means is that your Wordpress installation is sometimes using more memory than you have available. You can either optimize Wordpress to reduce memory usage or upgrade to more memory.

I recommend having 2GB of memory in this situation. If you have that, I would focus on optimizing Wordpress.


Thanks for your help Jarland. Ironically, this hasn’t reoccured since your post, so I can’t check it.

Can you recommend specific logs to look at? I’m not that au fait with Linux, or mySQL.

I’ve reviewed the Wordpress optimisation link you included, and I’m already covered there - I use lot of the caching strategies mentioned, including cloudflare.

I found that they could also be an XML-RPC attack, but the logs don’t indicate this.

Thanks again, and best wishes for your Thanksgiving.