查询日志设置

mysql-普通查询(General Query)慢查询(Slow Query)相关日志配置

只愿长相守 提交于 2019-12-01 09:05:58
配置 配置方法一: 服务启动时 # vi /etc/my.cnf ... log-output=TABLE,FILE general-log=1 slow-query-log=1 # systemctl restart mysqld log-output 默认是FILE,还有个值是NONE,就不输出日志了.我这里演示的是表和日志文件都输出. 配置方法二: 运行时 mysql> set global log_output="table", global general_log=on, global slow_query_log=on; 查看 查看相关变量: mysql> show variables like 'general%'; +------------------+--------------------------+ | Variable_name | Value | +------------------+--------------------------+ | general_log | ON | | general_log_file | /var/lib/mysql/srv00.log | +------------------+--------------------------+ 2 rows in set (0.00 sec) mysql> show