Help Center> GaussDB(for MySQL)> Troubleshooting> Backup and Restoration Issues> How Do I use mysqlbinlog to Obtain Binlog Files?
Updated on 2023-10-10 GMT+08:00

How Do I use mysqlbinlog to Obtain Binlog Files?

Use an ECS-based instance as an example.

  1. 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.

  2. 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).