首页 > 数据库技术 > 详细

MySQL general log

时间:2015-05-18 18:25:42      阅读:169      评论:0      收藏:0      [点我收藏+]

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

原文:http://www.cnblogs.com/xiaoit/p/4512549.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!