When your server kills a process it’s usually because the said process, actually takes so much RAM that it might crash your server. In your case it’s MySQL. MySQL in itself won’t start generating load unless there are queries to be executed. Having said that, for queries to be executed there needs to be some trigger whether it’s someone opening your application/website which then executes the query to a cron job you’ve configured executing queries.
Basically, MySQL generating load is because there are queries however the queries are a consequence from another action. This is what you’ll need to find out what it is.
Alternatively, it’s possible there isn’t as much traffic to MySQL however your queries to need a longer time to be executed thus generating load. You can always check how many queries you currently have running and the time they have been running by typing in
If there are a lot of queries however everyone show a time of under 50-60 seconds, then it would mean it’s either Website traffic or a cron job as we previously said.
It’s time to check if there is a lot of traffic on port 80 or 443. To do so, you have a couple of tools such as top,htop. These tools will show you the current processes in a graphical chart including but not only the memory each process takes, the time it has been running and the user that’s executing it. From there you can actually see which process is generating so much load.
If this proves fruitless, you might need to use the ps aux command. It shows all the processes running the time you executed the command. It provides you with process IDs which you can use to kill them.
The most common reason behind this is traffic. You can check the current traffic that is,has and trying to connect to your server by using the command nestat -punta.
Based on the information provided you’ll need to act and either block the Ip addresses if you feel they are not genuine or change your configurations.