STOP SLAVE [
thread_type] ... ]
thread_type: IO_THREAD | SQL_THREAD
Stops the slave threads.
SLAVE requires the
SUPER privilege. Recommended best
practice is to execute
STOP SLAVE on the
slave before stopping the slave server (see
Section 5.1.12, “The Shutdown Process”, for more information).
When using the row-based logging format:
You should execute
STOP SLAVE or
STOP SLAVE SQL_THREAD on the slave prior to
shutting down the slave server if you are replicating any tables
that use a nontransactional storage engine (see the
Note later in this section).
START SLAVE, this statement
may be used with the
SQL_THREAD options to name the thread or
threads to be stopped.
In MySQL 5.7,
STOP SLAVE causes
an implicit commit of an ongoing transaction. See
Section 13.3.3, “Statements That Cause an Implicit Commit”.
Beginning with MySQL 5.7.1,
gtid_next must be set to
AUTOMATIC before issuing this statement (Bug
In MySQL 5.7.2 and later, you can control how long
SLAVE waits before timing out by setting the
variable. This can be used to avoid deadlocks between
STOP SLAVE and other slave SQL statements
using different client connections to the slave. (Bug #16856735)
In MySQL 5.7,
SLAVE waits until the current replication event
group affecting one or more nontransactional tables has
finished executing (if there is any such replication group),
or until the user issues a
KILL QUERY or
CONNECTION statement. (Bug #319, Bug #38205)
In very old versions of MySQL (before 4.0.5), this statement was
SLAVE STOP. In MySQL 5.7,
that syntax produces an error.