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.
RESET MASTER also clears the values of the
gtid_purged system variable as
well as the global value of the
gtid_executed system variable
(but not its session value); that is, executing this statement
sets each of these values to an empty string
''). In MySQL 5.7.5 and later, this
statement also clears the
The mysql.gtid_executed Table).
This statement is intended to be used only when the master is started for the first time.
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 can prove useful
when you first set up the master and the slave, so that you can
verify the setup as follows:
Start the master and slave, and start replication (see Section 17.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 and getting rid of any unwanted and log files generated by testing, you can start the slave and begin replicating.