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

November 17, 2018 684 views
WordPress MySQL Databases Ubuntu 18.04

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
Az

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:

https://www-carnaghan-com.exactdn.com/wp-content/uploads/2016/05/OOM-killer-1.jpg

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.

https://codex.wordpress.org/WordPress_Optimization

Jarland

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.

Greg

Have another answer? Share your knowledge.