One-Click Install Wordpress Droplet - Error establishing database connection returns

Hey there, I have been trying to use the One-Click Install Wordpress Droplet for many many years now and every time after a certain while the droplet starts having the same problem. Error establishing a database connection. The MySQL error log is empty, and I have not found the reason for it so far and searching through the questions usually does not yield an answer so far either.

I found that the daily and weekly cron’s sometimes exit with errors apparently and I am not sure whether that might be related to the issue. Since MySQL does not exit with an error and does not show any errors in the logs and is not running when I ssh into the machine, a simple starting the service fixes the issue.

I have solved it in the past by having another cron-job checking whether MySQL is running and start it if not but that’s not clean and I’d love some help to figure out what the actual problem is. CPU, memory, disk and load are nowhere near any limit to have an impact on either cron or MySQL to be affected by it

Any suggestions or experience with how to fix this possibly?

Thank you

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello all,

This crash is most likely due to your system running out of memory. I’d suggest that you add a swap file to give yourself a bit more of a buffer. Check out this tutorial:

How To Add Swap on Ubuntu 18.04

What you can also do is to use the MySQLTuner script.

The MySQLTuner is a script written in Perl and allows you to quickly test your MySQL configuration and it gives you suggestions for adjustments to increase performance and stability.

According to the official GitHub page, it supports 300 indicators for MySQL/MariaDB/Percona Server in this last version.

To run the script you could do the following:

  • SSH to your Droplet
  • Download the script:
wget -O
  • Then execute it:

The script would run multiple checks against your MySQL instance, all checks done by MySQLTuner are documented here.

Also as stated in the official documentation, it is still extremely important for you to fully understand each change you make to a MySQL database server. If you don’t understand portions of the script’s output, or if you don’t understand the recommendations, you should consult a knowledgeable DBA or system administrator that you trust.

As a good practice make sure to always test your changes on staging environments before implementing them on your production database.

On the same note, if you want to have worry-free MySQL hosting and focus on your application, I would recommend trying out the DigitalOcean Managed Databases:


Hope that this helps! Regards, Alex

Hey everyone,

it happened again, actually twice, now I am going through logs and I dont see any error, nothing, no spikes, no weird requests, memory is fine, the swap file didn’t help.

It feels like there is something wrong, but the answer for this error are the same in a lot of threads on this page and I dont see an answer that has actually helped, unfortunately.

I am gonna upgrade the droplet as a next step to see whether that helps, though I am already using W3 Cache and Cloudflare as a CDN. I get the feeling that there is some basic error in the configuration of the droplet that keeps coming back - espcially given that I have experienced the same error with the same results and no help from the logs for the past few years trying to one a One-Click Install droplet.



thanks for the update. I’d remain confident that the applications are competing for the little spare RAM on the Droplet. Depending on what’s installed on your WP instance and what kind of traffic you’re seeing you could be cutting it fine with memory on a small droplet such as this.

In my experience you have some options now;

  1. Upgrade the droplet
  2. Analyse and tune MySQL queries using PMM/pt-query-digest (or tune Apache2 for memory usage)
  3. Move your database to a dedicated Droplet.

I understand that budget could be a factor here but you’ve bought some time with the swap space and at some stage, if your WP instance starts to pick up more traffic you might see an issue sooner rather than later.