Wordpress Error Establishing Database Connection

Can someone please help me with this, my Wordpress website always get this Error almost 2 times a week with Error Establishing Connection. I don’t know how to fix the issue, tried to ask for admin support but still the error is there.

This is the picture of the error -

This is the plugins i am using on my wordpress site -

please i need your help, my website almost down for 20mins or more depends on the time i check and reboot the droplets.

Submit an answer

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!

Sign In or Sign Up to Answer

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.


That’s what I originally thought judging by what you’ve said regarding the error noted.

As I said in my previous response, it is possible to run a working stack on 512MB, but it’s not quite as easy as set and forget. You have to constantly tweak and tune configuration for all services running (NGINX, MySQL/MariaDB, PHP-FPM, Redis/Memcached, etc).


From what I can see, you have ~30 plugins installed and active. That’s going to be taxing on limited resources.

The WP-Smush and EWWW plugins are redundant and taxing on the CPU as they both require CPU to handle smushing/compressing your images down.

The more images you upload and are processing, the more intensive. You don’t need them both, so I’d pick one or the other.


If you have Redis/Memcached installed, that’s going to chew up ~32-128MB of your RAM at any given time. The defaults are 64MB. Unless you need these services and are planning to run multiple servers, you’d be better off using PHP’s OpCode Caching. In most all cases, it’s going to be faster than Redis or Memcached as it’s handled by PHP natively and doesn’t need to be offloaded to a service.

Now, if you were running NGINX on one Droplet, PHP-FPM on another, your database on another, etc – (i.e. clustering) – then yeah, Redis or Memcached would be perfect.


I would recommend dropping Redis/Memcached and using PHP’s OpCode Caching for object cache. I would also choose either WP-Smush or EWWW, but not both. Additionally, reduce your plugins down to those you absolutely need – deactivate anything you aren’t using or don’t need.

Beyond those recommendations, it’s more of a challenge of tweaking and tuning, or upgrading your Droplet so that you have more RAM available. As noted above, I recommend 1GB minimum, but at least 2GB if you’re going to use this as a production Droplet that receives traffic so that you have the room you need to grow.

First, in my experience, a 512 MB/20 GB droplet can easily support a LAMP or LEMP stack for even a moderate load Wordpress site. Tweaking the configuration does help – see tutorials on DO for that, or here

The problem that you describe is quite common and I would start to troubleshoot it by checking the database connection information in your wp-config file. If that is all okay you may want to check your MySQL or MariaDB install (whichever you use). Typically, at least for me, it quite often comes down to user permission and privilege issues at the database level, particularly for the “root” user account. It’s a bit beyond the scope to go into details here so have a google around for more information – there is a lot of information available.

This comment has been deleted