content_image/760325.jpg
To avoid problems like this, use a single mysql  process to execute the contents of all binary logs that you want to process. Here is one way to do so: 

mysqlbinlog binlog.000001 binlog.000002 | mysql -u root -p 

Another approach is to write all the logs to a single file and then process the file: 

mysqlbinlog binlog.000001 > /tmp/statements.sql mysqlbinlog binlog.000002 >> /tmp/statements.sql mysql -u root -p -e "source /tmp/statements.sql" 

From MySQL 8.0.12, you can also supply multiple binary log files to mysqlbinlog  as streamed input using a shell pipe. An archive of compressed binary log files can be decompressed and provided directly to mysqlbinlog . In this example, binlog-files_1.gz  contains multiple binary log files for processing. The pipeline extracts the contents of binlog-files_1.gz , pipes the binary log files to mysqlbinlog  as standard input, and pipes the output of mysqlbinlog  into the mysql  client for execution: 

gzip -cd binlog-files_1.gz | ./mysqlbinlog - | ./mysql -uroot -p 

You can specify more than one archive file, for example: 

gzip -cd binlog-files_1.gz binlog-files_2.gz | ./mysqlbinlog - | ./mysql -uroot -p 

For streamed input, do not use --stop-position , because mysqlbinlog  cannot identify the last log file to apply this option. 

LOAD DATA operations. mysqlbinlog  can produce output that reproduces a LOAD DATA  operation without the original data file. mysqlbinlog  copies the data to a temporary file and writes a LOAD DATA LOCAL  statement that refers to the file. The default location of the directory where these files are written is system-specific. To specify a directory explicitly, use the --local-load  option. 

Because mysqlbinlog  converts LOAD DATA  statements to LOAD DATA LOCAL  statements (that is, it adds LOCAL ), both the client and the server that you use to process the statements must be configured with the LOCAL  capability enabled. See Section 6.1.6, “Security Considerations for LOAD DATA LOCAL” . 

## 4.6.9.1 mysqlbinlog Hex Dump Format 

<img src='content_image/760325.jpg'>

## Warning 

The temporary files created for LOAD DATA LOCAL  statements are not automatically deleted because they are needed until you actually execute those statements. You should delete the temporary files yourself after you no longer need the statement log. The files can be found in the temporary file directory and have names like original_file_name-#-# . 

The --hexdump  option causes mysqlbinlog  to produce a hex dump of the binary log contents: 

mysqlbinlog --hexdump source-bin.000001 

The hex output consists of comment lines beginning with # , so the output might look like this for the preceding command: 

/*!40019 SET @@SESSION.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; # at 4 #051024 17:24:13 server id 1 end_log_pos 98 # Position Timestamp Type Master ID Size Master Pos Flags # 00000004 9d fc 5c 43 0f 01 00 00 00 5e 00 00 00 62 00 00 00 00 00 # 00000017 04 00 35 2e 30 2e 31 35 2d 64 65 62 75 67 2d 6c |..5.0.15.debug.l| # 00000027 6f 67 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |og..............| # 00000037 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 

