Pre-General Availability Draft: 2017-07-28
RESET MASTER [TO binary_log_file_index_number]
RESET MASTER enables you to delete any binary
log files and their related binary log index file, returning the
master to its state before binary logging was started.
Use this statement with caution to ensure you do not lose binary log file data.
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
clause to start the binary log file index from a number other
1 after the reset. Issuing
RESET MASTER also clears the values of the
gtid_purged system variable and
variable; that is, issuing this statement sets each of these
values to an empty string (
statement also clears the
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
LOGS TO statements.
The following example demonstrates
RESET MASTER TO 1234; SHOW BINARY LOGS; +-------------------+-----------+ | Log_name | File_size | +-------------------+-----------+ | master-bin.001234 | 154 | +-------------------+-----------+
RESET MASTERremoves all binary log files that are listed in the index file, leaving only a single, empty binary log file with a numeric suffix of
.000001, whereas the numbering is not reset by
PURGE BINARY LOGS.
RESET MASTERis not intended to be used while any replication slaves are running. The behavior of
RESET MASTERwhen used while slaves are running is undefined (and thus unsupported), whereas
PURGE BINARY LOGSmay be safely used while replication slaves are running.
RESET MASTER without the
TO clause can prove useful when you first set
up the master and the slave, so that you can verify the setup as
Start the master and slave, and start replication (see Section 18.1.2, “Setting Up Binary Log File Position Based Replication”).
Execute a few test queries on the master.
Check that the queries were replicated to the slave.
RESET MASTERon the master to clean up the test queries.
After verifying the setup, resetting the master and slave and ensuring that no unwanted data or binary log files generated by testing remain on the master or slave, you can start the slave and begin replicating.