標籤:
1:查看版本
SELECT VERSION();
2:查看當前的日誌儲存方式
mysql> SHOW VARIABLES LIKE ‘%log_output%‘;+---------------+-------+| Variable_name | Value |+---------------+-------+| log_output | TABLE |+---------------+-------+1 row in set (0.00 sec)
3:查看當前是否開啟了general log
mysql> SHOW VARIABLES LIKE ‘%general_log%‘;+------------------+----------------------------+| Variable_name | Value |+------------------+----------------------------+| general_log | ON || general_log_file | /var/run/mysqld/mysqld.log |+------------------+----------------------------+2 rows in set (0.00 sec)
4:關閉開啟general log
mysql> SET GLOBAL GENERAL_LOG = ON;Query OK, 0 rows affected (0.00 sec)mysql> SET GLOBAL general_log_file =‘/tmp/general.log‘;Query OK, 0 rows affected (0.00 sec)mysql> SET GLOBAL GENERAL_LOG = OFF;Query OK, 0 rows affected (0.00 sec)
5:設定日誌的輸出格式
mysql> SHOW VARIABLES LIKE ‘%log_output%‘;+---------------+-------+| Variable_name | Value |+---------------+-------+| log_output | FILE |+---------------+-------+1 row in set (0.00 sec)mysql> SET GLOBAL log_output = ‘TABLE‘;Query OK, 0 rows affected (0.00 sec)
MySQL general log