Open MySQL slow query record _ MySQL

Source: Internet
Author: User
Enabling MySQL slow query record log is useful for tracking MySQL load optimization problems in the PHP + MySQL system, such as installing a lot of Discuz! Plug-in users, so that you can probably find out which plug-ins have code problems. In fact, it is very easy to enable MySQL slow query logs. you only need to add the log-slow-queries and long_query_time parameters to the MySQL configuration file.

Today, a friend asked me to bring the record up. For more MySQL optimization information, see here: http://www.ccvita.com/category/mysql

Enable MySQL slow query in Windows
In Windows, the configuration file of MySQL is usually my. ini. find [mysqld] and add
Log-slow-queries = F:/MySQL/log/mysqlslowquery. log
Long_query_time = 2

Enable MySQL slow query in Linux
The configuration file of MySQL in Windows is usually my. cnf. find [mysqld] and add
Log-slow-queries =/data/mysqldata/slowquery. log
Long_query_time = 2
Note:
Log-slow-queries = F:/MySQL/log/mysqlslowquery. log is the location where full query logs are stored. Generally, this directory requires the write permission of the MySQL running account. Generally, this directory is set to the MySQL data storage directory;
2 in long_query_time = 2 indicates that the query takes more than two seconds to record

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.