RESET SLAVE
The terms master and slave have historically been used in replication, but the terms terms primary and replica are now preferred. The old terms are used throughout the documentation, and in MariaDB commands, although MariaDB 10.5 has begun the process of renaming. The documentation will follow over time. See MDEV-18777 to follow progress on this effort.
Syntax
RESET SLAVE ["connection_name"] [ALL] [FOR CHANNEL "connection_name"]
Description
RESET SLAVE makes the slave forget its replication position in the master's binary log. This statement is meant to be used for a clean start. It deletes the master.info and relay-log.info files, all the relay log files, and starts a new relay log file. To use RESET SLAVE, the slave replication threads must be stopped (use STOP SLAVE if necessary).
Note: All relay log files are deleted, even if they have not been completely executed by the slave SQL thread. (This is a condition likely to exist on a replication slave if you have issued a STOP SLAVE statement or if the slave is highly loaded.)
Connection information stored in the master.info file is immediately reset using any values specified in the corresponding startup options. This information includes values such as master host, master port, master user, and master password. If the slave SQL thread was in the middle of replicating temporary tables when it was stopped, and RESET SLAVE is issued, these replicated temporary tables are deleted on the slave.
The ALL
also resets the PORT
, HOST
, USER
and PASSWORD
parameters for the slave. If you are using a connection name, it will permanently delete it and it will not show up anymore in SHOW ALL SLAVES STATUS.
connection_name
The connection_name
option is used for multi-source replication.
If there is only one nameless master, or the default master (as specified by the default_master_connection system variable) is intended, connection_name
can be omitted. If provided, the RESET SLAVE
statement will apply to the specified master. connection_name
is case-insensitive.
The FOR CHANNEL
keyword was added for MySQL compatibility. This is identical as using the channel_name directly after RESET SLAVE
.
RESET REPLICA
RESET REPLICA
is an alias for RESET SLAVE
from MariaDB 10.5.1.
See Also
- STOP SLAVE stops the slave, but it can be restarted with START SLAVE or after next MariaDB server restart.
© 2021 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/reset-replica/