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