If your WordPress server works normal for a few days and then shows the error message “Error Establishing a Database Connection” it is most likely due to heavy load to your website that your server could not handle. The extra load could be due to a lot of traffic from an incoming link or it could be a malicious actor attempting to brute force their way into your WordPress installation. If you have control of the server such as on AWS or Digital Ocean you can ssh into the server and restart the machine. But that fix is only temporary.
To solve the problem of the extra load on your database you need to implement caching on your WordPress server. You should also install some plugins to prevent malicious attempts to get access to your WordPress installation. Here are some plugins that work well together to prevent the “Error Establishing a Database Connection” error from appearing again.
Even if you don’t have the above error, installing these plugins will speed up your website and improve its security.
- WP Super Cache – Very fast caching plugin for WordPress
- Jetpack by WordPress.com – Jetpack protects your site against brute force attacks and unauthorized logins. Jetpack also monitors your site for downtime and keeps your plugins updated.
- iThemes Security – Take the guesswork out of WordPress security. iThemes Security offers 30+ ways to lock down WordPress in an easy-to-use WordPress security plugin.
Did you find this post helpful? Support independent development and improve your sleep by downloading White Noise and Deep Sleep Sounds free from the App Store.