Help Center/ Relational Database Service_RDS for MySQL/ FAQs/ Database Usage/ How Do I Use the mysqlbinlog Utility?
Updated on 2026-10-08 GMT+08:00

How Do I Use the mysqlbinlog Utility?

This section describes how to use mysqlbinlog to parse binlogs locally.

The basic unit of a binlog is binlog_event. Because the server writes binlogs in binary format, you need to use the mysqlbinlog tool to parse and display binlog contents in text format. This tool is generally located in the same directory as mysqld.

Invoking method: mysqlbinlog [options] log_file ...

Example: mysqlbinlog masterbin.000001

Example of binlog content:

# at 141#210309 9:28:36 server id 123 end_log_pos 245Query thread_id=3350 exec_time=11 error_code=0

  • at 141: starting position of the event in the binlog file.
  • #210309 9:28:36: timestamp information, indicating that the binlog file was written at 09:28:36 on March 9, 2021 (UTC).
  • Query thread_id: thread ID.

Common mysqlbinlog parameters:

  • --start-position: position where the parsing starts.
  • --start-datetime: time where the parsing starts.
  • --stop-position: position where the parsing stops.
  • --stop-datetime: time where the parsing stops.
  • --skip-gtids: gtid_log_event is not printed.
  • --short-form: Only statements are displayed.
  • --result-file: SQL file to which binlog parsing results are written.