MySQL keeps crashing on 512MB Droplet

September 29, 2014 6.1k views

Reading some other posts here it seems that using the smallest Droplet is prone to cause issues with MySQL. Lately the number of crashes has increased and I now have to restart MySQL several times per week, I really need to solve this.

What I've tried so far:

  • Updated the server using apt-get
  • Added a swap file
  • Checked MySQL logs for errors, nothing is output

I'm running the WordPress preinstall Droplet and for the site I'm using only 2 plugins, neither which are running any cron jobs. The site in question is
Any ideas?

1 comment
  • Try to see what process is using more ram. It's so easy to see it using: htop

    I had the same issue before using joomla, so I decided to change http apache by nginx, because apache was using too much memory and collapsing the droplet. After the replacement I don't have that problem again.

    Btw, I also have a droplet with 512mb RAM


3 Answers

You may also want to try a different theme...maybe just one of the default WordPress themes. Sometimes developers will write some hefty functions into themes that can cause problems.

I run several different droplets that are 512mb, WordPress sites on each of them with no problems. I did have to hunt down an issue on one of the droplets, but it turned out to be a wp-cron.

Also, there are couple of other things to check:

How much traffic does your site get? Do you have analytics installed so you can look at that?

Do you do anything to guard against brute-force attacks? If not, you should at least use login-lockdown plugin, which can help. It will also log any false attempts to login.

If you install that plugin, and then look in the settings an hour later and see tons of login attempts, then that could be a problem (but there are solutions..)

Also, do you have any other applications installed like phpMyadmin? Just to get a full picture of what is going on.

And finally, here is a script that will restart MySQL for you if it goes down:

that will not solve your problem, but it will at least keep your website up while you trouble-shoot.


I remember I have seen a similar topic before and there, the reason for crash was a large swap.. So by any chance do you have a very large swap file ??


miguelalcaino - thanks for suggesting htop. I can see that currently I'm using about 1% CPU, 148/490 RAM, and my Swap uses 55/255 (as MySQL is up and running). Are those numbers supposed to match up 512 together? Otherwise that's probably the cause.

sierracircle - Thanks for pointing those out. I've made sure not to have any phpMyAdmin folder present, and I'm running my own theme which utilize very little WP functionality. Also, traffic is low (below 100 visitors / day). Reg brute force attacks, I haven't actually looked into that. Will try the plugin you mentioned and see if there might be any issues.

  • I once had a site suddenly start crashing every day (but not on DigitalOcean..a different VPS webhost)

    It took me a lot of time to finally figure out that I was getting nailed with brute-force 1 every 10 seconds until the server would just crash.

    I did three things:

    installed login-lockdown
    changed my wp-login.php page to something different (I use a custom login page for each site I manage)
    used .htaccess to block access to the normal wp-login.php page

    Now I get 0 brute force attacks. I do this by default now on any new WordPress site I set up

  • Thanks, I tried the login-lockdown plugin and been running it all day. Hasn't logged any attempts yet. There seems to be something else that triggers it.

  • just to rule it out, you may want to switch to another theme (just temporarily). I know you said you developed the theme yourself, but there could be something there causing an issue...some eternal loop or typo..

Have another answer? Share your knowledge.