What can cause MySQL to crash?
Our websites went offline this morning and it turns out that this was due to MySQL crashing.
Is anyone able to provide any insights on what can cause MySQL to crash?
3 Replies
Hi there,
The first place you'll want to check for any immediate issues or errors is your Lish console.
For example, a common reason for MySQL errors is the Linux kernel’s OOM (Out of Memory) killer. You can immediately recognize this if you see messages similar to the following in your Lish console:
May 16 00:12:33 'hostname' kernel: Out of Memory: Killed process 0000 (mysqld).
If this is the case, you can run the following command to display your memory usage:
free -m
As well as the 'top' command to check the top memory consuming processes:
top -bn 1 -o %MEM | head -n15
Another useful resource that you may want to look into is utilizing a program such as MySQLTuner. The MySQLTuner script assesses your MySQL installation, and then outputs suggestions for increasing your server’s performance and stability.
How to Optimize MySQL Performance Using MySQLTuner
Again, this could be a helpful resource, but not always necessary in resolving Out of Memory issues that result in MySQL crashing.
Hopefully this gets you pointed in the right direction. Feel free to post a reply here in Community with any additional questions.
Hi,
You need to check your Apache log files,
If you found the Junk Requests as below
>
122.51.165.122 - - [18/Jun/2020:10:14:49 +0000] "GET /uploader.php HTTP/1.1" 302 -
122.51.165.122 - - [18/Jun/2020:10:14:49 +0000] "GET /cmd.php HTTP/1.1" 302 -
122.51.165.122 - - [18/Jun/2020:10:14:50 +0000] "GET /cmv.php HTTP/1.1" 302 -
122.51.165.122 - - [18/Jun/2020:10:14:50 +0000] "GET /cmdd.php HTTP/1.1" 302 -
122.51.165.122 - - [18/Jun/2020:10:14:50 +0000] "GET /knal.php HTTP/1.1" 302 -
122.51.165.122 - - [18/Jun/2020:10:14:51 +0000] "GET /cmd.php HTTP/1.1" 302 -
122.51.165.122 - - [18/Jun/2020:10:14:51 +0000] "GET /shell.php HTTP/1.1" 302 -
122.51.165.122 - - [18/Jun/2020:10:14:51 +0000] "GET /appserv.php HTTP/1.1" 302 -
122.51.165.122 - - [18/Jun/2020:10:14:51 +0000] "GET /scripts/setup.php HTTP/1.1" 302 -
>
The problem must be your server was under scanning or DDOS
more detail can be found here:
In response to @natradragon's post, you can derail this behavior using fail2ban(1).
You can also protect yourself from bad bots, phishers & malware hosts by integrating (some of) the lists from https://github.com/mitchellkrogza into your web server. There are lots of useful goodies here.
-- sw