In the process of checking mysql statements, you need to query the slower sql statements of mysql and output them, and then tune the slower sql statements, which also facilitates logging. From the output, you can view the specific sql statement.
1. Open the mysql console and check whether slow query is turned on.
show variables like'log_slow_queries';
is displayed as OFF
2. Use the mysql that comes with the program to open and run the program.
##3. Then select mysql that is Can.
4. When the next-level menu pops up, select my.ini.
log-slow-queries="D:/mysql/log/mysql-slow.log" #慢查询sql日志
long_query_time=5 #多长时间为慢sql 就是为超过5s的就输出日志
6. Then restart the program.
##7. After entering In the mysql console, running
show variables like'log_slow_queries';
The above is the detailed content of How to set up slow query log in MySQL?. For more information, please follow other related articles on the PHP Chinese website!