临时查看mysql实时SQL日志

软件开发大郭
0 评论
/
19 阅读
/
824 字
11 2022-01

设置临时开关

set global general_log='ON';

查看日志位置

show global variables like '%general%';

输出结果


+------------------+---------------------------------------------------+
| Variable_name    | Value                                             |
+------------------+---------------------------------------------------+
| general_log      | ON                                                |
| general_log_file | /usr/local/mysql/data/izj6c8l1o9y83q9flvmwoez.log |
+------------------+---------------------------------------------------+
2 rows in set (0.00 sec)

监控日志

根据上一步的general\_log\_file 文件位置,执行下面命令进行监控

tail -f /usr/local/mysql/data/izj6c8l1o9y83q9flvmwoez.log
    暂无数据