技术开发 频道

MySQL技巧 使用二进制日志恢复数据

  我们先打开.txt文件来分析一下。

  /*
  /*!40019 SET @@session.max_insert_delayed_threads=0
*/;
  
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
  DELIMITER
/*!*/;
  # at
4
  #
090427 15:27:56 server id 1 end_log_pos 106 Start: binlog v 4, server v 5.1.32-community-log created 090427 15:27:56
  BINLOG
'
  fF71SQ8BAAAAZgAAAGoAAAAAAAQANS4xLjMyLWNvbW11bml0eS1sb2cAAAAAAAAAAAAAAAAAAAAA
  AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
  
'/*!*/;
  # at
106
  #
090427 15:28:37 server id 1 end_log_pos 176 Query thread_id=1 exec_time=0 error_code=0
  
use mytest/*!*/;
  
SET TIMESTAMP=1240817317/*!*/;
  
SET @@session.pseudo_thread_id=1/*!*/;
  
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
  
SET @@session.sql_mode=1344274432/*!*/;
  
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
  
/*!/C gbk *//*!*/;
  
SET @@session.character_set_client=28,@@session.collation_connection=28,@@session.collation_server=28/*!*/;
  
SET @@session.lc_time_names=0/*!*/;
  
SET @@session.collation_database=DEFAULT/*!*/;
  
BEGIN
  
/*!*/;
  # at
176
  #
090427 15:28:37 server id 1 end_log_pos 204 Intvar
  
SET INSERT_ID=4/*!*/;
  # at
204
  #
090427 15:28:37 server id 1 end_log_pos 312 Query thread_id=1 exec_time=0 error_code=0
  
SET TIMESTAMP=1240817317/*!*/;
  
insert into test(val,data) values(40,'aaa')
  
/*!*/;
  # at
312
  #
090427 15:28:37 server id 1 end_log_pos 339 Xid = 12
  
COMMIT/*!*/;
  # at
339
  #
090427 15:28:46 server id 1 end_log_pos 409 Query thread_id=1 exec_time=0 error_code=0
  
SET TIMESTAMP=1240817326/*!*/;
  
BEGIN
  
/*!*/;
  # at
409
  #
090427 15:28:46 server id 1 end_log_pos 437 Intvar
  
SET INSERT_ID=5/*!*/;
  # at
437
  #
090427 15:28:46 server id 1 end_log_pos 545 Query thread_id=1 exec_time=0 error_code=0
  
SET TIMESTAMP=1240817326/*!*/;
  
insert into test(val,data) values(50,'bbb')
  
/*!*/;
  # at
545
  #
090427 15:28:46 server id 1 end_log_pos 572 Xid = 13
  
COMMIT/*!*/;
  # at
572
  #
090427 15:29:35 server id 1 end_log_pos 642 Query thread_id=1 exec_time=0 error_code=0
  
SET TIMESTAMP=1240817375/*!*/;
  
BEGIN
  
/*!*/;
  # at
642
  #
090427 15:29:35 server id 1 end_log_pos 670 Intvar
  
SET INSERT_ID=6/*!*/;
  # at
670
  #
090427 15:29:35 server id 1 end_log_pos 778 Query thread_id=1 exec_time=0 error_code=0
  
SET TIMESTAMP=1240817375/*!*/;
  
insert into test(val,data) values(60,'ccc')
  
/*!*/;
  # at
778
  #
090427 15:29:35 server id 1 end_log_pos 805 Xid = 14
  
COMMIT/*!*/;
  # at
805
  #
090427 15:30:21 server id 1 end_log_pos 875 Query thread_id=1 exec_time=0 error_code=0
  
SET TIMESTAMP=1240817421/*!*/;
  
BEGIN
  
/*!*/;
0
相关文章