> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/stop-replica.md).

# 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

```bnf
STOP { SLAVE | REPLICA } ["connection_name"] [thread_type [, thread_type] ... ]
    [FOR CHANNEL "connection_name"]

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

thread_type: IO_THREAD | SQL_THREAD
```

![Railroad diagram of STOP REPLICA — equivalent to the BNF above](/files/HTEXDMmNC5wVoTIBwnl2)

![Railroad diagram of thread\_type](/files/EEk52QYlpg5nBBzy95oq)

## Description

Stops the replica threads. `STOP SLAVE` requires the [SUPER](/docs/server/reference/sql-statements/account-management-sql-statements/grant.md#super) privilege, or, from [MariaDB 10.5.2](/docs/release-notes/community-server/old-releases/10.5/10.5.2.md), the [REPLICATION SLAVE ADMIN](/docs/server/reference/sql-statements/account-management-sql-statements/grant.md#replication-slave-admin) privilege.

Like [START REPLICA](/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/start-replica.md), 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 SLAVE` 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](/docs/server/reference/sql-statements/administrative-sql-statements/kill.md) or [KILL CONNECTION](/docs/server/reference/sql-statements/administrative-sql-statements/kill.md) statement.

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

#### STOP ALL REPLICAS

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

#### connection\_name

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

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

**MariaDB starting with** [**10.7.0**](/docs/release-notes/community-server/old-releases/10.7/10.7.0.md)

{% tabs %}
{% tab title="Current" %}
The `FOR CHANNEL` keyword is available for MySQL compatibility. This is identical as using the channel\_name directly after `STOP SLAVE`.
{% endtab %}

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

## See Also

* [CHANGE MASTER TO](/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/change-master-to.md) is used to create and change connections.
* [START REPLICA](/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/start-replica.md) is used to start a predefined connection.
* [RESET REPLICA](/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/reset-replica.md) is used to reset parameters for a connection and also to permanently delete a primary 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" %}
