How Do I use mysqlbinlog to Obtain Binlog Files?
Use an ECS-based instance as an example.
- Install a MySQL client on the ECS. For details, see How Can I Install the MySQL Client?
GaussDB(for MySQL) is only compatible with MySQL 8.0 or later.
- Download binlog files.
mysqlbinlog -hxxx -uxxx -Pxxx -pxxx binlog.xxxx --read-from-remote-server
Common mysqlbinlog parameters:
- -h: database host.
- -u: username.
- -P: port number.
- -p: password.
- --start-position: position where the decoding starts.
- --start-datetime: time when 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: The SQL file that binlog decoding results are written to.
- --read-from-remote-server: Binary logs are read from a remote server (It is available only when mysqlbinlogs and the database server are not on the same computer).
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.