mysqlbinlog 导出的sql格式是这样的

MySql 码拜 8年前 (2016-02-19) 1529次浏览
本人是这样导出的:
mysqlbinlog -d bullfrog –base64-output=decode-rows -v –start-datetime=”2015-10-19 07:34:0″ –stop-datetime=”2015-10-19 12:0:0″ mysql-bin.000097 >/home/s1.sql
# at 662586738
#151019 11:59:59 server id 2  end_log_pos 662586814 CRC32 0xc297dde4    Query   thread_id=2550688       exec_time=0     error_code=0
SET TIMESTAMP=1445227199/*!*/;
BEGIN
/*!*/;
# at 662586814
#151019 11:59:59 server id 2  end_log_pos 662586968 CRC32 0x78f44e35    Table_map: `bullfrog`.`v2_order` mapped to number 544
# at 662586968
#151019 11:59:59 server id 2  end_log_pos 662587050 CRC32 0x362f57ee    Table_map: `bullfrog`.`v2_order_status` mapped to number 556
# at 662587050
#151019 11:59:59 server id 2  end_log_pos 662587708 CRC32 0xe84508e1    Update_rows: table id 544 flags: STMT_END_F
### UPDATE `bullfrog`.`v2_order`
### WHERE
###   @1=6030959
###   @2=”271880″
###   @3=1445097132
###   @4=”parnunu”
###   @5=”Arissara Charles Peterson”
###   @6=”122/29 tiwanon road”
###   @7=”bangkrasor sub-district muangnonthaburi district”
###   @8=”parnu_nu@hotmail.com”
###   @9=”nonthaburi”
###   @10=””
###   @11=”Thailand”
###   @12=”TH”
###   @13=”11000″
###   @14=NULL
###   @15=”66804403210″
###   @16=2.700
###   @17=75
###   @18=0
###   @19=0
###   @20=1445098485
###   @21=1445097132
###   @22=”70000401009″
###   @23=18
###   @24=NULL
###   @25=0.000
###   @26=1
###   @27=”we4u365″
###   @28=0
###   @29=”181870944250-1416976999008″
###   @30=0
###   @31=1
###   @32=0
###   @33=0
###   @34=0
###   @35=NULL
###   @36=9
###   @37=12
###   @38=1445196685
###   @39=0
###   @40=1
###   @41=”B”
###   @42=1
###   @43=0
###   @44=1
###   @45=NULL
###   @46=0
###   @47=0
###   @48=0
###   @49=1445196685
### SET
###   @1=6030959
###   @2=”271880″
###   @3=1445097132
###   @4=”parnunu”
###   @5=”Arissara Charles Peterson”
###   @6=”122/29 tiwanon road”
###   @7=”bangkrasor sub-district muangnonthaburi district”
###   @8=”parnu_nu@hotmail.com”
###   @9=”nonthaburi”
###   @10=””
###   @11=”Thailand”
###   @12=”TH”
###   @13=”11000″
###   @14=NULL
###   @15=”66804403210″
###   @16=2.700
###   @17=75
###   @18=0
###   @19=0
###   @20=1445098485
###   @21=1445097132
###   @22=”70000401009″
###   @23=18
###   @24=NULL
###   @25=0.000
###   @26=1
###   @27=”we4u365″
###   @28=0
###   @29=”181870944250-1416976999008″
###   @30=0
###   @31=1
###   @32=0
###   @33=0
###   @34=0
###   @35=NULL
###   @36=9
###   @37=12
###   @38=1445227199
###   @39=0
###   @40=1
###   @41=”B”
###   @42=1
###   @43=0
###   @44=1
###   @45=NULL
###   @46=0
###   @47=0
###   @48=1
###   @49=1445196685
# at 662587708
#151019 11:59:59 server id 2  end_log_pos 662587739 CRC32 0x627fb4ac    Xid = 79497670
COMMIT/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
解决方案

20

导出就是这个样子。#开头的MYSQL会自动滤掉。

20

阿里有个叫canal的开源组件,可以将binlog的SQL完整还原,需要一点JAVA编程知识,可以试用。

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明mysqlbinlog 导出的sql格式是这样的
喜欢 (0)
[1034331897@qq.com]
分享 (0)