MySQL Slow log settings

Source: Internet
Author: User
Tags mysql slow query log

MySQL slow log query for the optimization of SQL is still very meaningful, specifically, how to open this MySQL slow query log (default is turned on).

There are a lot of official manuals or online settings for MySQL, but note that the mysql5.6 with the previous version about slow log settings whose variables have changed.

For MySQL's slow log on setting, set the following parameters under [Mysqld] in the My.ini (or my.cnf) file:

Here's how the previous version of 5.6 was set up:

#设置sql执行时间多长为慢查询

Long_query_time = 2

#设置把慢日志写在那里, the system will automatically produce a slow log file in the MySQL data directory, the file naming method is the computer name-slow.log

log-slow-queries = #表示没有使用索引的sql查询也会记录下来log-queries-not-using-indexes 5.6 version is set up:#开启慢查询 slow_ A query_log value of 1 or on indicates on, 0 or off for slow_query_log=on #设置慢查询日志放在哪里
slow_query_log_file=mysql-slow #设置sql执行时间多长为慢查询
long_query_time=2# indicates that SQL queries that do not use an index are also recorded log-queries-not-using-indexes

MySQL Slow log settings

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.