设置临时开关

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