MySQL suddenly using 99% CPU, but Wordpress is not in use
I use my Ubuntu Linode for hosting some Python cron jobs and a very simple static webpage in Apache.
I don't use WordPress or MySQL (in fact, I didn't know that MySQL was installed in my Linode).
My Linode has been running for more than a month using 1-2% CPU. I haven't changed any configuration for several weeks.
Today my Linode started using 99% CPU:
https://postimg.cc/svSS5SM1
I used htop to obtain information from the processes:
https://postimg.cc/ZWSNHRNH
I have no clue of what should I look next.
5 Replies
✓ Best Answer
That’s a lot of MySQL processes for a server that doesn’t use MySQL!
All but the first one (the one listed in white in the 2nd image) are threads.
If it does connect, then the high CPU could be someone brute force attacking your MySQL hoping to gain access. Use a cloud firewall (if you’re in a DC that supports it) or implement a local firewall on your Linode to only allow known services.
Better yet, boot to single user mode and de-install MySQL. Easy-peasy and you'll never have this problem again.
-- sw
That’s a lot of MySQL processes for a server that doesn’t use MySQL!
Is your MySQL service open to the world?
To check, go to this app (full disclosure: I wrote this app!) and enter your Linode’s public IP (try both v4 and v6).
https://soliddevtools.com/network-tools/open-port-checker?port=3306
If it does connect, then the high CPU could be someone brute force attacking your MySQL hoping to gain access. Use a cloud firewall (if you’re in a DC that supports it) or implement a local firewall on your Linode to only allow known services.
Thanks for the help!
But MySQL port is closed (I've tried both v4 ad v6).
I'm already using Linode's Cloud Firewall.
Any ideas?
Thank you stevewi, I think this is the best approach. Tomorrow I will try to do it and get you back with the results.
That did the trick. Thank you very much!