Mysql - mysqlbinlog读取操作binlog

1.SQL

//sql
flush logs;
show master status;
//查看binlog日志文件列表
show binary logs;
//查看binlog日志
show binlog events in 'mysql-bin.000360'; [ limit 0,10 ]

2.mysqlbinlog

//search all
mysqlbinlog mysql-bin.000360
//search by position
--start-position=630--stop-position=963
//search by date
-start-date="2021-10-25 12:00:00" --stop-date="2021-10-26 12:00:00"

//recovery
mysqlbinlog mysql-bin.000360 | mysql -u root -p

//export txt
mysqlbinlog mysql-bin.000360 > 1.log | mysql -u root -p
//export decode txt
mysqlbinlog --base64-output=decode-rows -v mysql-bin.000360 > 1.log | mysql -u root -p

你可能感兴趣的:(Mysql - mysqlbinlog读取操作binlog)