Error establishing a database connection ... MYSQL not running.

Hello there.

Two weeks ago I’ve already posted here, looking for help. The resolution I got can be found here.

I figured that the droplet I was using was the problem, so I moved on to another project, on another 1 click installation wordpress image.

The website worked fine for the last 4 days since I created it, reassuring me in my presumption that the first website’s droplet must’ve a problem.

However, about 2 hours ago, I received the error message “Error establishing a database connection” that led me here the first time.

Once again, the website itself is about 2gb large and uses a domain that was purchased 4 days ago. Since I have it linked to cloudways, I got a little curious.

Apparently my new domain received 15,595 from 43 unique users over the course of the last 4 days. I don’t have much knowledge in the ways of server management and while I don’t have caching enabled yet, something just seems super odd and I don’t believe that enabling SWAP as recommended in the linked thread is the solution here, given that my “free -h” response is

total: 985M used: 164M free: 617M

A quick # mysqladmin -u root -p status shwoed that my MYSQL is no longer running.

It also doesn’t appear to be a xmlrpc brute force since “sudo a2enconf block-xmlrpc” is already enabled.

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.

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, I have a similar issue, the thread is here -

I dont get any issues in the logs, cannot find a reason for mysql spontaneously stopping to work and I am now resizing my droplet, though I am running a cache plugin for Wordpress, I have Cloudflare running for the domain and Wordpress install and my memory seems free and fine, currently and in the monitoring tools.


There are a few things that I could suggest:

  • In order to fix your current problem I believe that you just need to start your MySQL service:
systemctl start mysql

It most likely crashed due to out of memory problem. You should be able to see the error at:

  • Check your access logs for any malicious activity, you could use this script here to summarize your access log:

  • Consider adding a caching plugin like W3 total cache or WP super cache, that way you would reduce the number of requests to your SQL instance as some of your content would be served from static cache.

  • Consider increasing the available RAM for your Droplet

  • Consider using a CDN service

Hope that this helps! Let me know if you have any questions. Regards, Bobby