How to turn on MySQL slow query mechanism

Source: Internet
Author: User

1 in MySQL, the default is not to turn on the slow query log function, we can use show variables like '%slow% ' to see. The results are as follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/26/EA/wKiom1NuKfvDr8nqAAFYiGubJfQ397.jpg "title=" Mysql.png "alt=" Wkiom1nukfvdr8nqaafyigubjfq397.jpg "/>

Parameter Description: Log_slow_queries Indicates whether the server side turns on slow query logging, Slow_query_log indicates whether MySQL monitors full query functionality on, Slow_query_log_file represents the physical location where log files are saved.

2 Turn on Full query monitoring function. Add the following configuration information under [mysqld] in MySQL configuration file my.cnf (not specified in detail):

Log_slow_queries=on
long_query_time=1# minimum time required for full query
Slow_query_log=on
log_queries_not_using_indexes=on# records those queries that do not use an index
#slow_query_log_file =d:\xampp\mysql\data\joson-pc-slow.log

When you're done, restart the MySQL server and use show variables like '%slow% ' again. Comparing with previous results, you will find that full query logging has been enabled.









This article is from the "Luther season" blog, make sure to keep this source http://zxgascend.blog.51cto.com/7974061/1409311

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.