mysqlbinlog基於時間點恢復


基於時間點恢復

/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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM