Opening the general log will log all SQL statements that arrive at MySQL server. Generally does not open the function, because the amount of log can be very large. However, in some cases, the general log may be temporarily opened for use by a barrier.
The relevant parameters are 3:general_log, Log_output, General_log_file
Show variables like ' General_log '; --Check if the log is open
Show variables like ' log_output '; --Look at the Log Output type table or file
Show variables like ' general_log_file '; --look at where the log files are saved
Set global general_log_file= ' TMP/GENERAL.LG '; --Set the location where the log files are saved
Set global general_log=on; --Turn on log function
Set global log_output= ' table '; --Set the output type to table
Set global log_output= ' file '; --Set Output type to file
Database thread
Show Processlist; --View current database thread status
Slow query
Show variables like "%slow%"; //View slow query settings
Set slow_query_log=' on '; //Enable slow query
Set global long_query_time=2; //Set to 2 seconds, plus global, the next time you enter MySQL is already in effect
Reference: http://blog.csdn.net/zyz511919766/article/details/49335949
http://renxiangzyq.iteye.com/blog/835397
Http://blog.51yip.com/mysql/972.html
Mysql:general_log log, database thread query, database slow query