Query slow query related parameters
show variables like '%quer%';
slow_query_log (whether Record slow query)
slow_query_log_file (slow log file path)
long_query_time (log will only be recorded after the set time)
Enable slow query log
(Linux) Add
slow_query_log=TRUE slow_query_log_file=/usr/local/mysql/slow_query_log.txt long_query_time=3
slow_query_log=TRUE slow_query_log_file=c:/slow_query_log.txt long_query_time=3
under the [mysqld] option of the my.ini configuration file. After restarting MySQL, re-query the relevant parameters to verify whether it is successfully opened
The above is the detailed introduction of MySQL tracking SQL execution and opening the slow query log. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!