MySQL 5.6 Reference Manual Including MySQL NDB Cluster 7.3-7.4 Reference Guide

13.4.1.2 RESET MASTER Statement

RESET MASTER

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 ('').

This statement is intended to be used only when the source is started for the first time.

Important

The effects of RESET MASTER differ from those of PURGE BINARY LOGS in 2 key ways:

  1. RESET MASTER removes 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.

  2. RESET MASTER is not intended to be used while any replicas are running. The behavior of RESET MASTER when used while replicas are running is undefined (and thus unsupported), whereas PURGE BINARY LOGS may be safely used while replicas are running.

See also Section 13.4.1.1, “PURGE BINARY LOGS Statement”.

RESET MASTER can prove useful when you first set up the source and the replica, so that you can verify the setup as follows:

  1. Start the source and replica, and start replication (see Section 17.1.1, “How to Set Up Replication”).

  2. Execute a few test queries on the source.

  3. Check that the queries were replicated to the replica.

  4. When replication is running correctly, issue STOP SLAVE followed by RESET SLAVE on the replica, then verify that any unwanted data no longer exists on the replica.

  5. Issue RESET MASTER on the source 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 replica and begin replicating.