Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.4Mb
PDF (A4) - 40.4Mb
PDF (RPM) - 40.0Mb
HTML Download (TGZ) - 10.6Mb
HTML Download (Zip) - 10.6Mb
HTML Download (RPM) - 9.2Mb
Man Pages (TGZ) - 241.4Kb
Man Pages (Zip) - 346.6Kb
Info (Gzip) - 3.9Mb
Info (Zip) - 3.9Mb
Excerpts from this Manual

MySQL 8.0 Reference Manual  /  ...  /  Pausing Replication on the Replica

17.1.7.2 Pausing Replication on the Replica

You can stop and start replication on the replica using the STOP REPLICA | SLAVE and START REPLICA | SLAVE statements. From MySQL 8.0.22, STOP SLAVE and START SLAVE are deprecated, and STOP REPLICA and START REPLICA are available to use instead.

To stop processing of the binary log from the source, use STOP REPLICA | SLAVE:

mysql> STOP SLAVE;
Or from MySQL 8.0.22:
mysql> STOP REPLICA;

When replication is stopped, the replication I/O thread stops reading events from the source binary log and writing them to the relay log, and the SQL thread stops reading events from the relay log and executing them. You can pause the I/O or SQL thread individually by specifying the thread type:

mysql> STOP SLAVE IO_THREAD;
mysql> STOP SLAVE SQL_THREAD;
Or from MySQL 8.0.22:
mysql> STOP REPLICA IO_THREAD;
mysql> STOP REPLICA SQL_THREAD;

To start execution again, use the START REPLICA | SLAVE statement:

mysql> START SLAVE;
Or from MySQL 8.0.22:
mysql> START REPLICA;

To start a particular thread, specify the thread type:

mysql> START SLAVE IO_THREAD;
mysql> START SLAVE SQL_THREAD;
Or from MySQL 8.0.22:
mysql> START REPLICA IO_THREAD;
mysql> START REPLICA SQL_THREAD;

For a replica that performs updates only by processing events from the source, stopping only the SQL thread can be useful if you want to perform a backup or other task. The I/O thread will continue to read events from the source but they are not executed. This makes it easier for the replica to catch up when you restart the SQL thread.

Stopping only the I/O thread enables the events in the relay log to be executed by the SQL thread up to the point where the relay log ends. This can be useful when you want to pause execution to catch up with events already received from the source, when you want to perform administration on the replica but also ensure that it has processed all updates to a specific point. This method can also be used to pause event receipt on the replica while you conduct administration on the source. Stopping the I/O thread but permitting the SQL thread to run helps ensure that there is not a massive backlog of events to be executed when replication is started again.