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.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot