MySQL blocks the requested replication change because the replica's SQL thread is still running and must be stopped first.
ER_SLAVE_SQL_THREAD_MUST_STOP happens when you try to ALTER or RESET replication while the replica SQL thread is active. Run STOP SLAVE SQL_THREAD, perform your change, then START SLAVE to resolve it.
ER_SLAVE_SQL_THREAD_MUST_STOP
MySQL raises ER_SLAVE_SQL_THREAD_MUST_STOP when you run an operation that alters replication state while the replica's SQL thread is active. The engine blocks the command to protect data consistency.
The error is returned with SQL state HY000 and message "This operation cannot be performed with a running slave." It was introduced in MySQL 5.7.3 and still appears in current 8.x versions.
The most frequent trigger is issuing RESET SLAVE, CHANGE MASTER TO, or ALTER REPLICA operations while the SQL thread is still processing relay logs. MySQL insists that the SQL thread be stopped to avoid partial application of transactions.
Scripts that automate failover, migrations, or schema changes often forget to include STOP SLAVE SQL_THREAD, leading to an unexpected failure mid-pipeline.
Stop the replica SQL thread, run the desired command, then restart replication. This three-step sequence clears the error and keeps replication healthy.
Use the following commands:
STOP SLAVE SQL_THREAD;
-- or for modern versions
STOP REPLICA SQL_THREAD;
-- now perform your change
RESET SLAVE ALL; -- example action
-- resume replication
START SLAVE; -- or START REPLICA;
Failover scripts should wrap CHANGE MASTER TO statements with STOP/START SLAVE blocks. If you hit the error during a mysqldump restore, issue STOP SLAVE SQL_THREAD before loading the dump.
When demoting a primary to replica, always confirm Seconds_Behind_Master is NULL (SQL thread stopped) before applying topology changes.
Automate STOP SLAVE SQL_THREAD in deployment tools.
Monitor show slave status or performance_schema.replication_applier_status_by_worker to verify the thread state.
In Galaxy, you can version a safe replication maintenance script in a shared Collection. Team members run the same endorsed commands, reducing human error.
ER_SLAVE_MUST_STOP (1192) appears when you attempt a conflicting operation with the IO thread running. The fix is analogous: STOP SLAVE IO_THREAD first.
ER_SLAVE_RUNNING (1207) signals that replication is already active when you try to START SLAVE twice.
Check thread status before issuing commands.
RESET SLAVE purges relay logs. Purging while SQL thread reads them risks corruption, so MySQL blocks the command.
CHANGE MASTER TO re-points the replica. The SQL thread must be stopped or you may apply transactions from two masters.
CI/CD or orchestration scripts sometimes omit the stop command, triggering the error during switchover.
Admins may forget to halt SQL thread before altering replication settings, especially under time pressure.
Raised when an operation requires the IO thread to stop. Fix with STOP SLAVE IO_THREAD.
Occurs when START SLAVE is executed while replication is already active. Check thread status first.
Indicates conflicts during replica initialization. Resolve by resetting and re-cloning the replica.
Only stop the SQL thread unless the command explicitly affects the IO thread. This minimizes replication lag.
No. It temporarily pauses statement execution but retains relay logs. Data is applied once you restart the thread.
Galaxy stores endorsed maintenance scripts. Running the vetted STOP-CHANGE-START sequence from a Collection prevents accidental omissions.
No. It originated in 5.7.3 and still exists in 8.0 and later Percona and MariaDB forks.