Mysql optimization and troubleshooting

Source: Internet
Author: User

Mysql optimization and troubleshooting

First, we will introduce several keywords.

1 show status indicates the current status data of the database

Show [session | global] status session is the statistical result of the current connection. global is all the statistical results since the Database Service was started.

Show status like 'com _ % '; among them, Com_XXX indicates the number of times the XXX statement is executed. We mainly focus on the parameters Com_select, Com_insert, Com_update, and Com_delete, which respectively indicate the number of queries and the number of additions, update count, delete count

 

In addition, several parameters are worth noting.

Connections: number of attempts to connect to the MySQL server

Uptime: the server's working time (unit: seconds)

Slow_queries: Number of slow queries

Then go to the key point for slow query.

When is the slow query time, that is, the query time exceeds the set time of the slow query, that is, the slow query time is set to 10 seconds, and a query exceeds 10 seconds. This query is called a slow query. you can set the time for querying slow queries.

First, check whether the slow query is enabled.

Use log_slow_queries to determine whether to enable long_query_time slow query.

Enable slow Query

Long_query_time = 2
Slow-query-log = On
Slow_query_log_file = "C:/Program Files/MySQL Server 5.6/mysql_slow_query.log"

Put these three parameters under [mysqlld] and restart the database service. Then, you can see that the slow query is enabled.

 

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.