欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

[MySQL binlog]mysql如何彻底解析Mixed日志格式的binlog

程序员文章站 2024-02-26 14:10:10
mysql binlog3种格式,row,mixed,statement. 解析工作 mysqlbinlog --base64-output=decode-rows -...

mysql binlog3种格式,row,mixed,statement. 解析工作

mysqlbinlog --base64-output=decode-rows -v mysql-bin.000144 |more

--base64-output=decode-rows: 会显示出row模式带来的sql变更。

-v :显示statement模式带来的sql语句

复制代码 代码如下:

[mysql@002tmp]$ mysqlbinlog --base64-output=decode-rows -v mysql-bin.000144 |more
/*!40019 set @@session.max_insert_delayed_threads=0*/;
/*!50003 set @old_completion_type=@@completion_type,completion_type=0*/;
delimiter /*!*/;
# at 4
#140216 23:59:26 server id 3  end_log_pos 107   start: binlog v 4, server v 5.5.25a-log created 140216 23:59:26
# at 107
#140216 23:59:26 server id 1  end_log_pos 171   query   thread_id=8557964       exec_time=0     error_code=0
set timestamp=1392595166/*!*/;
set @@session.pseudo_thread_id=8557964/*!*/;
set @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
set @@session.sql_mode=6291456/*!*/;
set @@session.auto_increment_increment=2, @@session.auto_increment_offset=1/*!*/;
/*!\c utf8mb4 *//*!*/;
set @@session.character_set_client=45,@@session.collation_connection=45,@@session.collation_server=33/*!*/;
set @@session.lc_time_names=0/*!*/;
set @@session.collation_database=default/*!*/;
begin
/*!*/;
# at 171
# at 260
#140216 23:59:26 server id 1  end_log_pos 260   table_map: `billing`.`billing_account` mapped to number 216
#140216 23:59:26 server id 1  end_log_pos 418   write_rows: table id 216 flags: stmt_end_f
### insert into billing.billing_account
### set
###   @1=80491
###   @2=1000013580491
###   @3=1000056980491
###   @4=1
###   @5=1
###   @6='integration-tests'
###   @7=2014-02-16 23:59:26
###   @8='integration-tests'
###   @9=2014-02-16 23:59:26
###   @10='integration-tests'
###   @11=null
###   @12='0'
###   @13=1000105380491
###   @14='0'
###   @15='159.153.208.254'
###   @16=1
###   @17=null
# at 418
# at 516
#140216 23:59:26 server id 1  end_log_pos 516   table_map: `billing`.`credit_card_account` mapped to number 222
#140216 23:59:26 server id 1  end_log_pos 812   write_rows: table id 222 flags: stmt_end_f
### insert into billing.credit_card_account
### set