Mysql>Show variables like 'long%'; Note: This long_query_time is used to define a "slow query" that is slower than the number of seconds.+-----------------+-----------+|Variable_name|Value|+-----------------+-----------+|Long_query_time| 10.000000 | +-----------------+-----------+1Rowinch Set(0.00sec) MySQL> SetLong_query_time=1; Note: I set 1, that is, the execution time of more than 1 seconds is a slow query. Query OK,0Rows Affected (0.00sec) MySQL>Show variables like 'slow%';+---------------------+---------------+|Variable_name|Value|+---------------------+---------------+|Slow_launch_time| 2 | |Slow_query_log| on |Note: If logging is turned on|Slow_query_log_file| /Tmp/Slow.Log |Note: Where to set+---------------------+---------------+3Rowsinch Set(0.00sec) MySQL> SetGlobal Slow_query_log=' on'Note: Turning on logging once the Slow_query_log variable is set to On,mysql will start recording immediately. /etc/the MY.CNF can set the initial value of the MySQL global variable above. Long_query_time=1Slow_query_log_file=/Tmp/Slow.Log
Reprinted from Http://www.cnblogs.com/zhenghongxin/p/5417030.html
"reprint" MySQL slow query