mysql 5.1.65 、 5.1.73 mysqlbinlog日志:
# at 368
#160318 23:58:44 server id 1 end_log_pos 458
Query thread_id=1
exec_time=0 error_code=0
SET TIMESTAMP=1458370724/*!*/;
insert into test values (2)
/*!*/;
# at 458
#160318 23:58:47 server id 1 end_log_pos 548 Query
thread_id=1 exec_time=0
error_code=0
SET TIMESTAMP=1458370727/*!*/;
insert into test values (3)
/*!*/;
# at 548
#160319 0:01:31 server id 1 end_log_pos 638 Query
thread_id=2 exec_time=0
error_code=0
SET TIMESTAMP=1458370891/*!*/;
delete from test where id=3
/*!*/;
# at 638
#160319 0:01:31 server id 1 end_log_pos 728 Query
thread_id=2 exec_time=639
error_code=0
SET TIMESTAMP=1458370891/*!*/;
delete from test where id=3
/*!*/;
还原;
/usr/local/mysql/bin/mysqlbinlog --start-position=368 --stop-position=458 /mybinlog/mysql-bin.000001 | mysql -u root -p
mysql 5.6.25 mysqlbinlog日志:
# at 3098
# at 3148
#160319 1:35:53 server id 1 end_log_pos 3195 CRC32 0x02d5af05
Table_map: `demo`.`test` mapped to number 75
# at 3195
#160319 1:35:53 server id 1 end_log_pos 3235 CRC32 0xe78e03ba
Write_rows: table id 75 flags: STMT_END_F
BINLOG '
aQ/tVhMBAAAALwAAAHsMAAAAAEsAAAAAAAEABGRlbW8ABHRlc3QAAQMAAQWv1QI=
aQ/tVh4BAAAAKAAAAKMMAAAAAEsAAAAAAAEAAgAB//4BAAAAugOO5w==
'/*!*/;
还原:
mysqlbinlog --start-position=3098 --stop-position=3235 /mydata/data/master-bin.000005 | mysql -u root -p
总结: 5.6.x 比较 5.1.x版本的日志来说,我感觉 5.1。x的清晰可见。感觉5.6版本之后好难看。但是还原语句还是没有变。