基于时间点恢复 mysql binlog

基于时间点恢复

/data/mysq/mysqlbin.000026   

#mysqlbinlog文件,恢复如下内容:

注意:按照时间点恢复时,可能同一个时间点有其他的操作,要结合上下文的时间选取~

# at 523

#181113 17:15:44 server id 161  end_log_pos 554 CRC32 0x2ad408d1 Xid = 4203

COMMIT/*!*/;

# at 554

#181113 17:16:01 server id 161  end_log_pos 637 CRC32 0x2b50f226 Query thread_id=324 exec_time=0 error_code=0

SET TIMESTAMP=1542100561/*!*/;

BEGIN

/*!*/;

# at 637

#181113 17:16:01 server id 161  end_log_pos 746 CRC32 0x711957ca Query thread_id=324 exec_time=0 error_code=0

SET TIMESTAMP=1542100561/*!*/;

update test set id=3 where id=4  #要取出的内容

/*!*/;

# at 746

#181113 17:16:01 server id 161  end_log_pos 777 CRC32 0x48210a15 Xid = 4217

COMMIT/*!*/;

# at 777

#181113 17:16:29 server id 161  end_log_pos 1201 CRC32 0xe8aa067a Query thread_id=324 exec_time=0 error_code=0

use `test`/*!*/;

SET TIMESTAMP=1542100589/*!*/;

create table student(

#基于时间恢复的命令如下:

[root@a mysql]# mysqlbinlog  mysqlbin.000026 --start-datetime='2018-11-13 17:15:50' --stop-datetime='2018-11-13 17:16:25' -r /opt/time.binlog

[root@a mysql]# grep update /opt/time.binlog

update test set id=3 where id=4

猜你喜欢

转载自blog.csdn.net/hehyyoulan/article/details/88173846