Error Establishing Database Connection

Posted February 20, 2018 3k views
UbuntuWordPressUbuntu 16.04

Hello there, Can someone please help me, I always got this Error Establishing Database Connection on my website and it almost appears every day. I am on 512mb / 20GB disk Plan ( Droplet) and my traffics range is only 500-800 traffics daily. Can someone please tell me how to fix this issue? Almost getting this issue from the beginning I created my website. My website Plugins posted below:

Complete Analytics Optimization Suite (CAOS)
Easy Social Share Buttons for WordPress
EasyRecipe Plus
Envato Market
Facebook Pixel
Instant Articles for WP
Jetpack by
jQuery Pin It Button for Images Pro
Nginx Helper
W3 Total Cache
Wordfence Security
WP Smush
Yoast SEO

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
1 answer


You’re getting that error because MySQL is crashing and so WordPress is no longer able to connect to it. MySQL and WordPress, especially with a lot of plugins installed, both require a lot of memory and a 512MB Droplet is not enough to handle those requirements.

I would recommend upgrading to a 1GB Droplet first—we have recently introduced new plans so you will be able to do that without any additional cost. But, you might want to also consider upgrading to a 2GB Droplet to make sure that both programs have some room to breathe.

Additionally, check out this tutorial on setting up Redis Caching. It is a bit old but the same instructions should work, though you might have to replace php5 with php7:

by Scott Miller
Redis is an open-source key value store that can operate as both an in-memory store and as cache. Redis is a data structure server that can be used as a database server on its own, or paired with a relational database like MySQL to speed things up. For this tutorial, Redis will be configured as a cache for WordPress to alleviate the redundant and time-consuming database queries used to render a WordPress page. The result is a WordPress site that is much faster.