Mysql--Binlog
1、检查binlog 是否开启
show variables like '%log_bin%';
如果没有开启:
在/etc/my.cnf中的[mysqld]下面直接增加内容
server_id=1918
log_bin = mysql-bin
binlog_format = ROW
退出并保存
重启mysql 服务
查看所有binlog日志
show master logs;
产生一个新的log日志
Flush logs
清空binlog日志
reset master
查看binlog日志信息
show binlog events in 'mysql-bin.000003';
/usr/local/mysql/bin/mysqlbinlog ./mysql-bin.000011
查看bin-log日志的失效时间
show variables like '%expire_logs_days%';
指定查询,从pos点406开始查询
show binlog events in 'mysql-bin.000040' from 17940;
恢复数据库数据
mysqlbinlog --database=ca --exclude-gtids E:/mysql/mysql-5.7.29-win32/data/mysql-bin.000001 | mysql -u root -p