The terms master and slave have historically been used in replication, and MariaDB has begun the process of adding primary and replica synonyms. The old terms will continue to be used to maintain backward compatibility - see MDEV-18777 to follow progress on this effort.


RESET REPLICA ["connection_name"] [ALL]  [FOR CHANNEL "connection_name"] -- from MariaDB 10.5.1         
RESET SLAVE ["connection_name"] [ALL]  [FOR CHANNEL "connection_name"]              


RESET REPLICA/SLAVE makes the replica forget its replication position in the master's binary log. This statement is meant to be used for a clean start. It deletes the and files, all the relay log files, and starts a new relay log file. To use RESET REPLICA/SLAVE, the replica threads must be stopped (use STOP REPLICA/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 REPLICA/SLAVE statement or if the slave is highly loaded.)

Note: RESET REPLICA does not reset the global gtid_slave_pos variable. This means that a replica server configured with CHANGE MASTER TO MASTER_USE_GTID=slave_pos will not receive events with GTIDs occurring before the state saved in gtid_slave_pos. If the intent is to reprocess these events, gtid_slave_pos must be manually reset, e.g. by executing set global gtid_slave_pos="".

Connection information stored in the 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 replica SQL thread was in the middle of replicating temporary tables when it was stopped, and RESET REPLICA/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 REPLICAS/SLAVE STATUS.


The connection_name option is used for multi-source replication.

If there is only one nameless primary, or the default primary (as specified by the default_master_connection system variable) is intended, connection_name can be omitted. If provided, the RESET REPLICA/SLAVE statement will apply to the specified primary. connection_name is case-insensitive.

MariaDB starting with 10.7.0

The FOR CHANNEL keyword was added for MySQL compatibility. This is identical as using the channel_name directly after RESET REPLICA.


MariaDB starting with 10.5.1

RESET REPLICA is an alias for RESET SLAVE from MariaDB 10.5.1.

See Also


Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.