The cpu usage of mysql is too high. For example, my dedecms system occupies about 60% of the CPU when generating html pages. I also have 8-core cpu, this is not a problem with the data volume. However, if your mysql account for a high cpu usage and the website does not have any traffic, the problem may occur, let me analyze the causes and solutions for you.
Recently, Mysql Cpu usage is too high on the server. The Troubleshooting process is as follows:
The Code is as follows: |
Copy code |
// Log on to Mysql # Mysql-u root-p // Query the SQL statement currently being executed Mysql> show full processlist; |
Locate the problem based on the query results, and then solve the problem.
In this way, we can analyze the SQL statements that occupy the cpu and then optimize the database or SQL.
Another method is to modify the mysql wait time wait_timeout, which can also be solved. However, pay attention to the various factors that affect the speed of your website. Do not stop the website when it does not open mysql.
Wait_timeout:
The number of seconds that the server waits for action on a connection before closing it. The default value is 28800. I will change it to 7200.
Note: you can modify the parameters by modifying the/etc/my. cnf file and restarting mysql.