SHOW BINLOG EVENTS
SHOW BINLOG EVENTS [IN 'log_filename'] [FROMposition] [LIMIT [offset,]count]
This statement displays the events in a binary log file. Use
the IN clause to specify a particular log file. If the
IN clause is omitted, the current file is used. To
obtain a list of binary log files, use the SHOW MASTER LOGS statement. Here is an example of how you can
use this statement and typical results:
SHOW BINLOG EVENTS IN 'log-bin.000161'\G
*************************** 1. row ***************************
Log_name: log-bin.000161
Pos: 4
Event_type: Start
Server_id: 1
Orig_log_pos: 4
Info: Server ver: 4.1.7-standard-log, Binlog ver: 3
1 row in set (0.00 sec)This log file has only one row of data because the SQL statement
was run shortly after the server was started. For a larger log file
recording many rows of events, the results take a long time and drain
system resources significantly. To minimize this, you can focus and
limit the results with the FROM and
LIMIT clauses. In the results, notice the Pos label
with a value of 4. In a large log file, that number might be in the
thousands. The results displayed could be focused only on rows
starting from a particular position in the log with the
FROM clause. You can limit the number of rows of
events displayed with the LIMIT clause. In the
LIMIT clause, you can also set the starting point
of the output based on the number of rows in the results set and limit
them to a certain number of rows. Here is an example of both of these
clauses:
SHOW BINLOG EVENTS IN 'log-bin.000160'
FROM 3869 LIMIT 2,1\G
*************************** 1. row ***************************
Log_name: log-bin.000160
Pos: 4002
Event_type: Intvar
Server_id: 1
Orig_log_pos: 4002
Info: INSERT_ID=5In this example, the retrieval of log events is to begin from
position 3869 as set by the FROM clause. The results set
contains several rows, although only one is shown here. The display is
limited to one row, starting from the third one in the results set per
the LIMIT clause. The number of skipped records is
the sum of the FROM argument and the first
LIMIT argument.
As an alternative to using this statement when working with
large binary log files, you might try using the
mysqlbinlog utility and redirecting the results to a text file that you can
read in a text editor when it’s finished. Besides, this utility will
provide you more information than SHOW BINLOG EVENTS.