您的位置:首页 > 数据库 > MySQL

mysql中bin-log日志操作常用命令

2015-09-14 10:02 851 查看
查看日志是否开启

1).可以通过Mysql配置文件my.cnf来确认(Mysql默认开启二进制日志记录):

# Replication Master Server (default)

# binary logging is required for replication

log-bin=mysql-bin

刷新日志

flush logs;

查看当前日志位置

show master status;

查看当前所有日志

show master logs;

清空所有的bin-log日志

reset master;

查看日志内容

mysqlbinlog –no-defaults mysql-bin.00001;

删除bin-log

mysql> purge binary logs to 'ablelee.000003';

Query OK, 0 rows affected (0.16 sec)

关闭 bin-log 日志

找到配置文件my.cnf,对于linux,一般默认在/etc目录下,打开此文件,使用井号(#)注释掉如下两个配置项目即可。

log-bin=mysql-bin

binlog_format=mixed

显示所有日志

mysql> show binary logs;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql log-bin