Troubleshooting of Cpu usage in Mysql

Source: Internet
Author: User
Tags high cpu usage

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.