# RESET REPLICA

{% hint style="info" %}
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](https://jira.mariadb.org/browse/MDEV-18777) to follow progress on this effort.
{% endhint %}

## Syntax

```sql
RESET { SLAVE | REPLICA } ["connection_name"] [ALL]  [FOR CHANNEL "connection_name"].
```

## Description

RESET REPLICA makes the replica forget its [replication](https://mariadb.com/docs/server/ha-and-performance/standard-replication) position in the master's [binary log](https://mariadb.com/docs/server/server-management/server-monitoring-logs/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](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/relay-log) files, and starts a new relay log file. To use RESET REPLICA, the replica threads must be stopped (use [STOP REPLICA](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/stop-replica) if necessary).

Note: All relay log files are deleted, even if they have not been completely executed by the replica SQL thread. (This is a condition likely to exist on a replication replica if you have issued a STOP REPLICA statement or if the replica 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 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 replica SQL thread was in the middle of replicating temporary tables when it was stopped, and RESET REPLICA is issued, these replicated temporary tables are deleted on the replica.

The `ALL` also resets the `PORT`, `HOST`, `USER`, and `PASSWORD` parameters for the replica. If you are using a connection name, it will be permanently deleted it and it will not show up anymore in [SHOW ALL REPLICAS STATUS](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-replica-status).

#### connection\_name

The `connection_name` option is used for [multi-source replication](https://mariadb.com/docs/server/ha-and-performance/standard-replication/multi-source-replication).

If there is only one nameless primary, or the default primary (as specified by the [default\_master\_connection](https://mariadb.com/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables) system variable) is intended, `connection_name` can be omitted. If provided, the `RESET REPLICA` statement will apply to the specified primary. `connection_name` is case-insensitive.

**MariaDB starting with** [**10.7.0**](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.7/10.7.0)

{% tabs %}
{% tab title="Current" %}
The `FOR CHANNEL` keyword was added for MySQL compatibility. This is identical to using the channel\_name directly after `RESET REPLICA`.
{% endtab %}

{% tab title="< 10.7.0" %}
`FOR CHANNEL` is not available.
{% endtab %}
{% endtabs %}

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

**MariaDB starting with** [**11.6.0**](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/11.6/11.6.0)

{% tabs %}
{% tab title="Current" %}
`RESET REPLICA` resets the `Master`/`Slave_last_event_time` and `Connects_Tried` values (see [SHOW REPLICA STATUS](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-replica-status)).
{% endtab %}

{% tab title="< 12.0" %}
`RESET REPLICA` resets the `Master`/`Slave_last_event_time` values (see [SHOW REPLICA STATUS](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-replica-status)).
{% endtab %}

{% tab title="< 11.6" %}
`RESET REPLICA` does not reset the `Master`/`Slave_last_event_time` values (see [SHOW REPLICA STATUS](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-replica-status)).
{% endtab %}
{% endtabs %}

## See Also

* [STOP REPLICA](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/stop-replica) stops the replica, but it can be restarted with [START REPLICA](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/start-replica) or after next MariaDB server restart.

<sub>*This page is licensed: GPLv2, originally from*</sub> [<sub>*fill\_help\_tables.sql*</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}
