mysql is using 100% cpu and causing establishing database error

my droplet: 4 GB Memory / 80 GB Disk / BLR1 - Ubuntu/ wordpress/ woo commerce I’m getting database error every 2 hour, sometime i can resolve it by restarting the droplet, and sometime i need to restore a backup funny thing that sometimes i don’t do anything and the matter is resolved by itself, but i lose my custom css…i have no idea what is the relation here! but when database error happen, i see that cpu usage is above 100% and i run mysql-tuner and got: [!!] Maximum possible memory usage: 9.9G (257.48% of installed RAM) [!!] Overall possible memory usage with other process exceeded memory

I need help in fining out the solution for cpu 100% I need help in configuration of my.cnf for my droplet: 4GB/ 80GB

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.

Bobby Iliev
Site Moderator
Site Moderator badge
June 19, 2022
Accepted Answer

Hi there,

I would suggest a few things:

  • Try following the steps from this tutorial here on how to tweak your MySQL server for better performance:

  • Add a caching plugin for your site so that it would make fewer requests to the database itself.

  • Use a CDN service like Cloudflare to make reduce the overall work that your server has to do.

  • Consider switching to a Managed MySQL database which is optimized for you out of the box:

Let me know if you have any questions!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel