Skip to content

MySQL 如何查看慢查询是否开启及慢查询 log 日志位置

🏷️ MySQL

连接 MySQL 后执行如下查询

sql
show variables like '%slow%';

输出结果

+---------------------------+------------------------------------------------------+
| Variable_name             | Value                                                |
+---------------------------+------------------------------------------------------+
| log_slow_admin_statements | OFF                                                  |
| log_slow_slave_statements | OFF                                                  |
| slow_launch_time          | 2                                                    |
| slow_query_log            | OFF                                                  |
| slow_query_log_file       | D:\wamp\bin\mysql\mysql5.6.17\data\LIUJJ-PC-slow.log |
+---------------------------+------------------------------------------------------+

变量说明

  • slow_query_log:是否开启慢查询日志

  • slow_query_log_file:慢查询日志文件存放位置