- 5.7.27 bin/mysql -uroot -S /tmp/mysql.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.27-log MySQL Community Server (GPL) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> set binlog_format='MIXED'; Query OK, 0 rows affected (0.00 sec) mysql> set binlog_row_image="full"; Query OK, 0 rows affected (0.00 sec) mysql> set tx_isolation='READ-COMMITTED'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> create database a; Query OK, 1 row affected (0.00 sec) mysql> create database b; Query OK, 1 row affected (0.00 sec) mysql> create table a.test (id int primary key, name varchar(50) default null, age bigint); Query OK, 0 rows affected (0.00 sec) mysql> create table b.test (id int primary key, name varchar(50) default null, age bigint); Query OK, 0 rows affected (0.04 sec) mysql> insert into a.test(id, age) values (1,5), (2,10); /* This insert event is written with full row image in binary log */ Query OK, 2 rows affected (0.01 sec) Records: 2 Duplicates: 0 Warnings: 0 mysql> insert into b.test(id,age) select id , age from a.test ; /* name column information is not present in row image */ Query OK, 2 rows affected (0.00 sec) Records: 2 Duplicates: 0 Warnings: 0 - extract from binlog bin/mysqlbinlog --base64-output=decode-rows -vv 93423/master-bin.000001 /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 #190819 11:39:00 server id 1 end_log_pos 123 CRC32 0x8df321b3 Start: binlog v 4, server v 5.7.27-log created 190819 11:39:00 at startup # Warning: this binlog is either in use or was not closed properly. ROLLBACK/*!*/; # at 123 #190819 11:39:00 server id 1 end_log_pos 154 CRC32 0xee9701a4 Previous-GTIDs # [empty] # at 154 #190819 11:40:11 server id 1 end_log_pos 219 CRC32 0xe16899a9 Anonymous_GTID last_committed=0 sequence_number=1 rbr_only=no SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/; # at 219 #190819 11:40:11 server id 1 end_log_pos 304 CRC32 0xdb435880 Query thread_id=2 exec_time=0 error_code=0 SET TIMESTAMP=1566207611/*!*/; SET @@session.pseudo_thread_id=2/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=1436549152/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create database a /*!*/; # at 304 #190819 11:40:11 server id 1 end_log_pos 369 CRC32 0xe79639b1 Anonymous_GTID last_committed=1 sequence_number=2 rbr_only=no SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/; # at 369 #190819 11:40:11 server id 1 end_log_pos 454 CRC32 0x8eca7129 Query thread_id=2 exec_time=0 error_code=0 SET TIMESTAMP=1566207611/*!*/; create database b /*!*/; # at 454 #190819 11:40:11 server id 1 end_log_pos 519 CRC32 0xee5cba35 Anonymous_GTID last_committed=2 sequence_number=3 rbr_only=no SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/; # at 519 #190819 11:40:11 server id 1 end_log_pos 669 CRC32 0x5f99e131 Query thread_id=2 exec_time=0 error_code=0 SET TIMESTAMP=1566207611/*!*/; create table a.test (id int primary key, name varchar(50) default null, age bigint) /*!*/; # at 669 #190819 11:40:11 server id 1 end_log_pos 734 CRC32 0x99c46a59 Anonymous_GTID last_committed=3 sequence_number=4 rbr_only=no SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/; # at 734 #190819 11:40:11 server id 1 end_log_pos 884 CRC32 0x60251243 Query thread_id=2 exec_time=0 error_code=0 SET TIMESTAMP=1566207611/*!*/; create table b.test (id int primary key, name varchar(50) default null, age bigint) /*!*/; # at 884 #190819 11:40:11 server id 1 end_log_pos 949 CRC32 0xa780c931 Anonymous_GTID last_committed=4 sequence_number=5 rbr_only=yes /*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*//*!*/; SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/; # at 949 #190819 11:40:11 server id 1 end_log_pos 1017 CRC32 0x3be2c7a3 Query thread_id=2 exec_time=0 error_code=0 SET TIMESTAMP=1566207611/*!*/; BEGIN /*!*/; # at 1017 #190819 11:40:11 server id 1 end_log_pos 1065 CRC32 0x52a88bcc Table_map: `a`.`test` mapped to number 108 # at 1065 #190819 11:40:11 server id 1 end_log_pos 1126 CRC32 0x4bec0d4a Write_rows: table id 108 flags: STMT_END_F ### INSERT INTO `a`.`test` ### SET ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ ### @2=NULL /* VARSTRING(50) meta=50 nullable=1 is_null=1 */ ### @3=5 /* LONGINT meta=0 nullable=1 is_null=0 */ ### INSERT INTO `a`.`test` ### SET ### @1=2 /* INT meta=0 nullable=0 is_null=0 */ ### @2=NULL /* VARSTRING(50) meta=50 nullable=1 is_null=1 */ ### @3=10 /* LONGINT meta=0 nullable=1 is_null=0 */ # at 1126 #190819 11:40:11 server id 1 end_log_pos 1157 CRC32 0xae4b7e91 Xid = 10 COMMIT/*!*/; # at 1157 #190819 11:40:13 server id 1 end_log_pos 1222 CRC32 0x09f2b411 Anonymous_GTID last_committed=5 sequence_number=6 rbr_only=yes /*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*//*!*/; SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/; # at 1222 #190819 11:40:13 server id 1 end_log_pos 1290 CRC32 0x42a46636 Query thread_id=2 exec_time=0 error_code=0 SET TIMESTAMP=1566207613/*!*/; BEGIN /*!*/; # at 1290 #190819 11:40:13 server id 1 end_log_pos 1338 CRC32 0xe32d6917 Table_map: `b`.`test` mapped to number 109 # at 1338 #190819 11:40:13 server id 1 end_log_pos 1399 CRC32 0x6918bb6f Write_rows: table id 109 flags: STMT_END_F ### INSERT INTO `b`.`test` ### SET ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ ### @3=5 /* LONGINT meta=0 nullable=1 is_null=0 */ ### INSERT INTO `b`.`test` ### SET ### @1=2 /* INT meta=0 nullable=0 is_null=0 */ ### @3=10 /* LONGINT meta=0 nullable=1 is_null=0 */ # at 1399 #190819 11:40:13 server id 1 end_log_pos 1430 CRC32 0x19fde3fa Xid = 11 COMMIT/*!*/; SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; -- mysql> TRUNCATE TABLE a.test; Query OK, 0 rows affected (0.00 sec) mysql> TRUNCATE TABLE b.test; Query OK, 0 rows affected (0.01 sec) mysql> SET binlog_format="ROW"; Query OK, 0 rows affected (0.00 sec) mysql> insert into a.test(id, age) values (1,5), (2,10); /* This insert event is written with full row image in binary log */ Query OK, 2 rows affected (0.00 sec) Records: 2 Duplicates: 0 Warnings: 0 mysql> insert into b.test(id,age) select id , age from a.test ; /* name column information is not present in row image */ Query OK, 2 rows affected (0.00 sec) Records: 2 Duplicates: 0 Warnings: 0 mysql> - extract from binlog TRUNCATE TABLE a.test /*!*/; # at 1579 #190819 11:43:48 server id 1 end_log_pos 1644 CRC32 0xf1b51908 Anonymous_GTID last_committed=7 sequence_number=8 rbr_only=no SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/; # at 1644 #190819 11:43:48 server id 1 end_log_pos 1728 CRC32 0xd0edc40a Query thread_id=2 exec_time=0 error_code=0 SET TIMESTAMP=1566207828/*!*/; TRUNCATE TABLE b.test /*!*/; # at 1728 #190819 11:43:48 server id 1 end_log_pos 1793 CRC32 0x31464fe7 Anonymous_GTID last_committed=8 sequence_number=9 rbr_only=yes /*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*//*!*/; SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/; # at 1793 #190819 11:43:48 server id 1 end_log_pos 1861 CRC32 0xa0a9d782 Query thread_id=2 exec_time=0 error_code=0 SET TIMESTAMP=1566207828/*!*/; BEGIN /*!*/; # at 1861 #190819 11:43:48 server id 1 end_log_pos 1909 CRC32 0x75025d94 Table_map: `a`.`test` mapped to number 110 # at 1909 #190819 11:43:48 server id 1 end_log_pos 1970 CRC32 0x51b63e33 Write_rows: table id 110 flags: STMT_END_F ### INSERT INTO `a`.`test` ### SET ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ ### @2=NULL /* VARSTRING(50) meta=50 nullable=1 is_null=1 */ ### @3=5 /* LONGINT meta=0 nullable=1 is_null=0 */ ### INSERT INTO `a`.`test` ### SET ### @1=2 /* INT meta=0 nullable=0 is_null=0 */ ### @2=NULL /* VARSTRING(50) meta=50 nullable=1 is_null=1 */ ### @3=10 /* LONGINT meta=0 nullable=1 is_null=0 */ # at 1970 #190819 11:43:48 server id 1 end_log_pos 2001 CRC32 0x8bfe1b0b Xid = 16 COMMIT/*!*/; # at 2001 #190819 11:43:50 server id 1 end_log_pos 2066 CRC32 0xf921d61d Anonymous_GTID last_committed=9 sequence_number=10 rbr_only=yes /*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*//*!*/; SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/; # at 2066 #190819 11:43:50 server id 1 end_log_pos 2134 CRC32 0x25af02bd Query thread_id=2 exec_time=0 error_code=0 SET TIMESTAMP=1566207830/*!*/; BEGIN /*!*/; # at 2134 #190819 11:43:50 server id 1 end_log_pos 2182 CRC32 0xcbb75fd1 Table_map: `b`.`test` mapped to number 111 # at 2182 #190819 11:43:50 server id 1 end_log_pos 2243 CRC32 0x9ca588aa Write_rows: table id 111 flags: STMT_END_F ### INSERT INTO `b`.`test` ### SET ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ ### @2=NULL /* VARSTRING(50) meta=50 nullable=1 is_null=1 */ ### @3=5 /* LONGINT meta=0 nullable=1 is_null=0 */ ### INSERT INTO `b`.`test` ### SET ### @1=2 /* INT meta=0 nullable=0 is_null=0 */ ### @2=NULL /* VARSTRING(50) meta=50 nullable=1 is_null=1 */ ### @3=10 /* LONGINT meta=0 nullable=1 is_null=0 */ # at 2243 #190819 11:43:50 server id 1 end_log_pos 2274 CRC32 0x6a8b994d Xid = 17 COMMIT/*!*/; SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/; DELIMITER ; # End of log file /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;