View status show VARIABLES like '%slow_query_log% '
Turn on set global show_query_log=1 (fail after reboot)
Permanent effect Modification MY.CNF join
Slow_query_log=1
Show_query_log_file=/var/lib/mysql/at-slow.log
Modify Time Threshold (default is >10s)
SHOW VARIABLES like ' long_query_time% '
SET GLOBAL long_query_time=3
After setting, you need to open an interface to see the value
Simulation: By performing Selec sleep (4), and then look at the log file as the following effect
Log Analysis Tool Mysqldumpslow
S: Sort by what way
C: Number of visits
L: Lockout time
R: Return record
T: Query time
Al: Average lockout time
AR: Average number of returned records
At: Average query time
T: Returns the number of previous data
G: Behind with a regular match pattern, case insensitive
Common return recordsets up to 10 SQL
Mysqldumpslow-s r-t 10/var/lib/mysql/**-slow.log
10 most visited SQL
-S C-T 10/var/lib/mysql/**-slow.log
Sort by search time first 10 queries with left connection
-S T-t 10-g "left join" **.log
Recommended Use | More piece of use to prevent pop-up screen
-S T-t 10-g "left join" **.log | More
Mysql Slow Query log