See if the current server is turned on slow query:
1, Quick way, run SQL statement show VARIABLES like "%slow%"  
2, go directly to my.conf. Configuration in
my.conf (added below [mysqld])
[mysqld]
Log-slow-queries =/usr/local/mysql/var/ Slowquery.log
Long_query_time = 1 #单位是秒
log-queries-not-using-indexes
Use SQL statements to modify: cannot be modified according to the items in the my.conf. Modify the variables listed by the "show VARIABLES like"%slow% ""
Statement and run the following sql:
Set global log_slow_queries = on;
Set global slow_query_log = on;
set global long_query_time=0.1; SQL statement for #设置大于0.1s
Slow query log file Information format:
# time:130905 14:15:59 time is September 5, 2013 14:15:59 (the front part is easy to see wrong, at first glance it is time stamp)
# [email protected]: root[root] @ [183.239.28.174] request client IP
# query_time:0.735883 Lock_ for MySQL server time:0.000078 rows_sent:262 rows_examined:262 Here indicates how many seconds to execute, 0.735883 seconds, 1 seconds equals 1000 milliseconds
SET timestamp= 1378361759; I don't know what to do at the moment.
Show tables from ' test_db '; This is the key message indicating that the statement was executed at the time
Set the millisecond level relationship to the MySQL version
Many online data show that, prior to 5.21, the long_query_time minimum in my.conf can only be set to 1 (that is, 1 seconds minimum). I made my own crooked hit and found that I could achieve it by other means.
"Long_query_time = 0.1" This way I didn't try because the database server was running. Reboot required. So I didn't try. I am using global variable settings to implement slow log query logging.
You can implement a millisecond level record by setting the global variable:
Set Global Long_query_time = 0.01
The MySQL version on my server is: 5.1.60-log
I've tried this way to work.
How do you test whether your query will be recorded?
Run statement
Select Sleep (0.13);
I deliberately set the 0.13-second delay, and the statement is logged to the log file as expected (because it was set more than 0.1 seconds ago).
MySQL turn on slow query log implementation