发布网友 发布时间:2022-04-24 06:05
共1个回答
热心网友 时间:2022-05-05 06:20
mysql> show variables like slow%;+---------------------+------------------------------------+| Variable_name | Value |+---------------------+------------------------------------+| slow_launch_time | 2 || slow_query_log | OFF || slow_query_log_file | /opt/mysql/data/localhost-slow.log |+---------------------+------------------------------------+3 rows in set (0.00 sec)上述语句查看“慢查询”的配置信息,你可以自定义日志文件的存放,但必须将 slow_query_log 全局变量设置为“ON”状态,执行以下语句: mysql> set global slow_query_log=ON;Query OK, 0 rows affected (0.01 sec)结果: mysql> show variables like slow%;+---------------------+------------------------------------+| Variable_name | Value |+---------------------+------------------------------------+| slow_launch_time | 2 || slow_query_log | ON || slow_query_log_file | /opt/mysql/data/localhost-slow.log |+---------------------+------------------------------------+3 rows in set (0.00 sec)