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)

  

 

相关文章:

  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
  • 2021-08-15
  • 2021-10-27
  • 2021-07-30
  • 2021-06-03
  • 2022-03-01
猜你喜欢
  • 2021-04-22
  • 2021-12-05
  • 2021-10-21
  • 2021-11-02
  • 2021-09-19
  • 2022-12-23
  • 2022-01-01
相关资源
相似解决方案