MySQL open slow query and mysql5.6 open slow query error

Source: Internet
Author: User
Tags mysql in mysql slow query log

Open MySQL Slow query

MySQL Slow query log for tracking Php+mysql system under the MySQL load tuning problem is very useful, such as installing a lot of discuz! plug-ins users, so you can probably troubleshoot those plug-ins have code problems. In fact, the slow query log to enable MySQL is very simple, only need to add log-slow-queries and long_query_time two parameters in the MySQL configuration file.


windows open MySQL slow query

The code is as follows Copy Code

MySQL in Windows system configuration file is generally My.ini find [mysqld] below plus
Log-slow-queries = F:/mysql/log/mysqlslowquery.log
Long_query_time = 2


MySQL slow query enabled under Linux

MySQL in Windows system configuration file is generally my.cnf find [mysqld] below plus

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

Attention

Log-slow-queries = F:/mysql/log/mysqlslowquery.log for slow query log storage location, general this directory to have MySQL running account can write permission, generally this directory is set to MySQL data storage directory;
2 of the long_query_time=2 means that the query is recorded for more than two seconds;

Updated September 24, 2009

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

Today, I open MySQL slow query, MySQL service can not start, error:

[ERROR] Mysql:unknown variable ' log-slow-queries=d:/programdata/mysql/phpec_org-slow.log '

Half a day can not find the reason, after continuous Baidu, found that the original MYSQL5.6 version of the above has been canceled log-slow-queries This parameter, changed to Slow-query-log-file.

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.