mysql日志

来源:互联网 发布:知君本无邪二腐书 编辑:程序博客网 时间:2024/05/16 04:49

mysql有以下几种日志:  
  错误日志:   -log-err   
 查询日志:   -log  
  慢查询日志:     -log-slow-queries  
  更新日志:     -log-update  
  二进制日志:   -log-bin  
   
  在mysql的安装目录下,打开my.ini,在后面加上上面的参数,保存后重启mysql服务就行了。  
  例如:  
  #Enter   a   name   for   the   binary   log.   Otherwise   a   default   name   will   be   used.  
  #log-bin=  
  #Enter   a   name   for   the   query   log   file.   Otherwise   a   default   name   will   be   used.  
  #log=  
  #Enter   a   name   for   the   error   log   file.   Otherwise   a   default   name   will   be   used.  
  log-error=  
  #Enter   a   name   for   the   update   log   file.   Otherwise   a   default   name   will   be   used.  
  #log-update=       

查看日至:
1. 首先确认你日志是否启用了
mysql>show variables like 'log_bin';
如果启用了,即ON
那日志文件就在mysql的安装目录的data目录下
cat/tail 日志文件名

2. 怎样知道当前的日志
mysql> show master status;

3. 查看从某一段时间到某一段时间的日志

mysqlbinlog --start-datetime='2008-01-19 00:00:00' --stop-datetime='2008-01-30 00:00:00'  /var/log/mysql/mysql-bin.000006 > mysqllog1.log

 

释:二进制日志已经代替了老的更新日志,更新日志在MySQL 5.1中不再使用。

原创粉丝点击