Name

SHOW BINLOG EVENTS

Synopsis

SHOW BINLOG EVENTS [IN 'log_filename']
   [FROM position] [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 ...

Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.