RDBMS Type: MySQL
RESET MASTER [TO binary_log_file_index_number]
Use this statement with caution to ensure you do not lose any wanted
binary log file data and GTID execution history.
RESET MASTER requires the RELOAD privilege.
For a server where binary logging is enabled (log_bin is ON), RESET
MASTER deletes all existing binary log files and resets the binary log
index file, resetting the server to its state before binary logging was
started. A new empty binary log file is created so that binary logging
can be restarted.
For a server where GTIDs are in use (gtid_mode is ON), issuing RESET
MASTER resets the GTID execution history. The value of the gtid_purged
system variable is set to an empty string (''), the global value (but
not the session value) of the gtid_executed system variable is set to
an empty string, and the mysql.gtid_executed table is cleared (see
#replication-gtids-gtid-executed-table). If the GTID-enabled server has
binary logging enabled, RESET MASTER also resets the binary log as
described above. Note that RESET MASTER is the method to reset the GTID
execution history even if the GTID-enabled server is a replica where
binary logging is disabled; RESET SLAVE has no effect on the GTID
execution history. For more information on resetting the GTID execution
Issuing RESET MASTER without the optional TO clause deletes all binary
log files listed in the index file, resets the binary log index file to
be empty, and creates a new binary log file starting at 1. Use the
optional TO clause to start the binary log file index from a number
other than 1 after the reset.
Using RESET MASTER with the TO clause to specify a binary log file
index number to start from simplifies failover by providing a single
statement alternative to the FLUSH BINARY LOGS and PURGE BINARY LOGS TO
statements. Check that you are using a reasonable value for the index
number. If you enter an incorrect value, you can correct this by
issuing another RESET MASTER statement with or without the TO clause.
If you do not correct a value that is out of range, the server cannot
The following example demonstrates TO clause usage:
RESET MASTER TO 1234;
SHOW BINARY LOGS;
| Log_name | File_size | Encrypted |
| source-bin.001234 | 154 | No |