Rechercher dans le manuel MySQL
13.4.1.2 RESET MASTER Syntax
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.
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. Issuing
RESET MASTER
also clears the values of the
gtid_purged
system variable and
the gtid_executed
system
variable; that is, issuing this statement sets each of these
values to an empty string (''
). This
statement also clears the mysql.gtid_executed
table (see
mysql.gtid_executed Table).
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 be restarted.
The following example demonstrates TO
clause
usage:
- +-------------------+-----------+-----------+
- | Log_name | File_size | Encrypted |
- +-------------------+-----------+-----------+
- +-------------------+-----------+-----------+
The effects of RESET MASTER
without the TO
clause differ from those of
PURGE BINARY LOGS
in 2 key
ways:
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 byPURGE BINARY LOGS
.RESET MASTER
is not intended to be used while any replication slaves are running. The behavior ofRESET MASTER
when used while slaves are running is undefined (and thus unsupported), whereasPURGE BINARY LOGS
may 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
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.
When replication is running correctly, issue
STOP SLAVE
followed byRESET SLAVE
on the slave, then verify that no unwanted data from the test queries exists on the slave.Issue
RESET MASTER
on 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.
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-reset-master.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.