Help Center > > FAQs> Database Usage> How Do I Use the mysqlbinlog Tool?

How Do I Use the mysqlbinlog Tool?

Updated at: Jun 09, 2021 GMT+08:00

This section describes how to use the mysqlbinlog tool to locally parse binlogs on HUAWEI CLOUD.

The basic unit of binlog is the binlog event. Servers write binlog files in binary format. Therefore, if you want to display the binlog content in text format, you need to use the mysqlbinlog tool to parse the binlog. Generally, this tool is stored 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 is written at 09:28:36 on March 9, 2021 (UTC).
  • Query thread_id: thread ID.

Common mysqlbinlog parameters:

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

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel