默认情况下,mysql安装是没有启用日志管理,这为后续的维护带来很多不便的地方。
以下是配置的整个过程
编辑my.ini,找到[msqld]部分,加入以下命令
[mysql]
log="E:/mysqllog/mysql.log"
重启mysql
mysql> show variables like "log%";
+---------------------------------+----------------+
| Variable_name | Value |
+---------------------------------+----------------+
| log | ON |
| log_bin | ON |
| log_bin_trust_function_creators | OFF |
| log_error | .\ts17-113.err |
| log_slave_updates | OFF |
| log_slow_queries | OFF |
| log_warnings | 1 |
+---------------------------------+----------------+
此处log行可以看到日志已经启用
打开E:/mysqllog/mysql.log,可以看到刚刚使用过的命令
mysql.log文件
D:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt, Version: 5.0.22-community-nt-log. started with:
TCP Port: 3306, Named Pipe: (null)
Time Id Command Argument
110704 15:57:39 1 Connect root@localhost on kbq
1 Query show variables like "log%"
110704 15:58:52 1 Query SELECT DATABASE()
110704 15:58:57 1 Query select * from test
110704 15:58:59 1 Query show tables
参考文章
MYSQL启用日志,和查看日志
http://blog.csdn.net/iori97king/article/details/5901632