MySQL 5.5 Open Slow query log method

Source: Internet
Author: User
Tags ini mysql in

Linux enable MySQL slow query

The code is as follows Copy Code

Vim/etc/my.cnf
[Mysqld]
Slow-query-log = on # Open slow query function
Slow_query_log_file =/usr/local/mysql/data/slow-query.log # Slow query log store path and name
Long_query_time = 5 # query statement with more than 5s query time
### log-queries-not-using-indexes = on # list query statements that do not use indexes

windows open MySQL slow query

MySQL in Windows system configuration file is generally My.ini find [mysqld] below plus

The code is as follows Copy Code
Log-slow-queries = F:\MySQL\log\mysqlslowquery.log
Long_query_time = 2

Add:

Add the Log-queries-not-using-indexes parameter to the MY.CNF or My.ini, which indicates that the query that does not use the index is logged. Like what:

The code is as follows Copy Code
Log-slow-queries=/data/mysqldata/slowquery.log
long_query_time=2
Log-queries-not-using-indexes

Analyze the slow query log tool Mysqlsla This is a very good tool in Linux to help us see some slow query log oh state.

Mysqlsla-lt Slow/var/lib/mysql/slowquery.log

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.