mysql binlog
2016-01-28 21:26 youxin 阅读(210) 评论(0) 编辑 收藏 举报MYSQL启用日志
# whereis my.ini
# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysqld_safe]
log-error=/var/log/mysqld.log
long_query_time =1
log-slow-queries=slowqueris.log
log-queries-not-using-indexes = nouseindex.log
log=mylog.log
pid-file=/var/run/mysqld/mysqld.pid
--------------------------------------------------------
查看日志
是否启用了日志
mysql>show variables like 'log_bin';
怎样知道当前的日志
mysql> show master status;
看二进制日志文件用mysqlbinlog
shell>mysqlbinlog mail-bin.000001
或者shell>mysqlbinlog mail-bin.000001 | tail
Windows 下用类似的命令。
mysql有以下几种日志:
错误日志: -log-err
查询日志: -log
慢查询日志: -log-slow-queries
更新日志: -log-update
二进制日志: -log-bin
在mysql的安装目录下,打开my.ini,在后面加上上面的参数,保存后重启mysql服务就行了。