- 查看LOG功能
root@localhost : test【01:07:46】5 SQL->SHOW VARIABLES LIKE "general_log%";
#如下general_log值为OFF说明没有开启
+------------------+---------------------------------+
| Variable_name | Value |
+------------------+---------------------------------+
| general_log | OFF |
| general_log_file | /usr/local/mysql/data/xag57.log |
+------------------+---------------------------------+
#臨時開啟
root@localhost : test【01:56:29】6 SQL->SET GLOBAL general_log = 'ON';
root@localhost : test【02:04:37】7 SQL->SET GLOBAL general_log_file = '/usr/local/mysql/logs/general_log.log';
root@localhost : test【02:04:47】8 SQL->SHOW VARIABLES LIKE "general_log%";
+------------------+---------------------------------------+
| Variable_name | Value |
+------------------+---------------------------------------+
| general_log | ON |
| general_log_file | /usr/local/mysql/logs/general_log.log |
+------------------+---------------------------------------+
- 永久开启
#永久有效需要配置my.cnf文件,加入下面两行:
general_log = 1
general_log_file = /usr/local/mysql/logs/general_log.log
- 實時查看日誌
[root@xag57 logs]# tail -100f /usr/local/mysql/logs/general_log.log