How to configure slow query records for MySQL in Linux

Source: Internet
Author: User
In Linux, enable MySQL slow query. The configuration file of MySQL in Windows is usually my. cnf. Find [mysqld] and add log-slow-queriesdatamysqldatas.

In Linux, enable MySQL slow query. The configuration file of MySQL in Windows is usually my. cnf. Find [mysqld] and add log-slow-queries =/data/mysqldata/s.

MySQL slow query record logs are useful for tracking MySQL load tuning issues 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.

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.