# STOP 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
STOP { SLAVE | REPLICA } ["connection_name"] [thread_type [, thread_type] ... ] 
[FOR CHANNEL "connection_name"]

STOP ALL { SLAVES | REPLICAS } [thread_type [, thread_type]]

STOP { SLAVE | REPLICA } ["connection_name"] [thread_type [, thread_type] ... ]

STOP ALL { SLAVES | REPLICAS } [thread_type [, thread_type]] 

thread_type: IO_THREAD | SQL_THREAD
```

## Description

Stops the replica threads. `STOP REPLICA` requires the [SUPER](https://mariadb.com/docs/server/reference/account-management-sql-statements/grant#super) privilege, or, from [MariaDB 10.5.2](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/old-releases/10.5/10.5.2), the [REPLICATION SLAVE ADMIN](https://mariadb.com/docs/server/reference/account-management-sql-statements/grant#replication-slave-admin) privilege.

Like [START REPLICA](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/start-replica), this statement may be used with the `IO_THREAD` and`SQL_THREAD` options to name the thread or threads to be stopped. In almost all cases, one never need to use the `thread_type` options.

`STOP REPLICA` waits until any current replication event group affecting one or more non-transactional tables has finished executing (if there is any such replication group), or until the user issues a [KILL QUERY](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/kill) or [KILL CONNECTION](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/kill) statement.

Note that `STOP REPLICA` doesn't delete the connection permanently. Next time you execute [START REPLICA](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/start-replica) or the MariaDB server restarts, the replica connection is restored with it's [original arguments](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/change-master-to). If you want to delete a connection, you should execute [RESET REPLICA](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/reset-replica).

#### STOP ALL REPLICAS

`STOP ALL REPLICAS` stops all your running replicas. It will give you a `note` for every stopped connection. You can check the notes with [SHOW WARNINGS](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-warnings).

#### 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 master, or the default master (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 `STOP REPLICA` statement will apply to the specified master. `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 is available for MySQL compatibility. This is identical as using the channel\_name directly after `STOP REPLICA`.
{% endtab %}

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

## See Also

* [CHANGE MASTER TO](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/change-master-to) is used to create and change connections.
* [START REPLICA](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/start-replica) is used to start a predefined connection.
* [RESET REPLICA](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/reset-replica) is used to reset parameters for a connection and also to permanently delete a master connection.

<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" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/stop-replica.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
