Question

MySQL keeps crashing on 512MB Droplet

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 http://saturate.co. Any ideas?

Show comments

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.

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:

https://github.com/sierracircle/services-checker

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

Hello there,

I’ll highly recommend you to examine the server’s resource usage and try to indicate if certain service/process is consuming the server’s resources and thus causing issues with the droplet’s performance.

We have a tutorial that covers the basic usage of the following tools (Top, Netstat, Du, & Other Tools) that can help you to monitor the server resources.

https://www.digitalocean.com/community/tutorials/how-to-use-top-netstat-du-other-tools-to-monitor-server-resources

You can also check this question which was previously asked in our community:

https://www.digitalocean.com/community/questions/how-to-find-the-processes-that-are-consuming-the-most-server-resources

Regards

Hello there,

What you can do is to tweak the MySQL configuration using 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 http://mysqltuner.pl/ -O mysqltuner.pl
  • Then execute it:
perl mysqltuner.pl

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 a worry-free MySQL hosting and focus on your application, I would recommend trying out the DigitalOcean Managed Databases:

https://www.digitalocean.com/products/managed-databases-mysql/

Hope that this helps!