Common SQL Errors

MySQL Error 1906: ER_SLAVE_IO_THREAD_MUST_STOP - How to Fix and Prevent

Galaxy Team
August 8, 2025

The replica IO thread is running while you attempt an operation that needs it stopped.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 1906 (ER_SLAVE_IO_THREAD_MUST_STOP)?

MySQL error 1906 (ER_SLAVE_IO_THREAD_MUST_STOP) signals that a replication command cannot run because the replica IO thread is still active. Stop the thread with STOP SLAVE IO_THREAD, perform your CHANGE MASTER TO or RESET SLAVE step, then restart replication.

Error Highlights

Typical Error Message

ER_SLAVE_IO_THREAD_MUST_STOP

Error Type

Replication Error

Language

MySQL

Symbol

io thread; run STOP SLAVE IO_THREAD first. ER_SLAVE_IO_THREAD_MUST_STOP was added in 5.7.4, removed after 5.7.5.

Error Code

1906

SQL State

HY000

Explanation

Table of Contents

What is MySQL error 1906 (ER_SLAVE_IO_THREAD_MUST_STOP)?

MySQL raises error 1906 when you issue a replication command that modifies the replication configuration while the IO thread on the replica is still running. The server blocks the change to protect replication integrity.

The message appears mainly with CHANGE MASTER TO, RESET SLAVE, or START SLAVE when issued in an incorrect order. MySQL versions 5.7.4 through 5.7.5 exposed this error code; later versions still enforce the rule but return a generic replication error.

What Causes This Error?

The error fires because MySQL disallows modification of replication settings while the IO thread is actively reading the binary log from the source. Stopping the IO thread ensures a clean state before changes are applied.

Typical triggers include attempting CHANGE MASTER TO to point a replica at a new source, resetting replication while threads run, or switching channels without pausing replication.

How to Fix ER_SLAVE_IO_THREAD_MUST_STOP

Stop the replica IO thread, run the desired replication command, then restart replication. This three-step pattern resolves the error safely in all supported MySQL versions.

Common Scenarios and Solutions

Scenario: Migrating a replica to a new primary. Solution: STOP SLAVE IO_THREAD; CHANGE MASTER TO ...; START SLAVE;

Scenario: Cleaning relay logs with RESET SLAVE. Solution: STOP SLAVE; RESET SLAVE; START SLAVE;

Best Practices to Avoid This Error

Adopt a checklist that always stops replication threads before altering replication configuration. Automate this sequence in deployment scripts to prevent manual mistakes.

Monitor thread status with SHOW PROCESSLIST or performance_schema.replication_connection_status to confirm threads are stopped before proceeding.

Related Errors and Solutions

Error 1192 - ER_SLAVE_LOCKING_FAILURE: occurs when the SQL thread cannot acquire a lock. Stop both threads, apply the lock fix, then restart.

Error 1593 - ER_SLAVE_RELAY_LOG_READ_FAILURE: indicates relay log read problems. Use FLUSH RELAY LOGS and ensure IO thread is stopped during maintenance.

Common Causes

Attempting CHANGE MASTER TO while IO thread is running

The most frequent cause. Operators forget to pause the IO thread before redirecting the replica to a new source.

Running RESET SLAVE without stopping replication

RESET SLAVE purges relay logs and internal metadata. MySQL blocks the command if either replication thread remains active.

Automation scripts that skip STOP SLAVE IO_THREAD

Custom scripts may mistakenly call CHANGE MASTER TO directly, especially after upgrades. Insert explicit STOP statements to harden automation.

Related Errors

MySQL Error 1192 - ER_SLAVE_LOCKING_FAILURE

Raised when the SQL thread cannot obtain a necessary lock. Often fixed by stopping both replication threads before retrying.

MySQL Error 1593 - ER_SLAVE_RELAY_LOG_READ_FAILURE

Indicates problems reading relay logs, sometimes appearing after disk issues. Requires flushing relay logs and restarting replication.

MySQL Error 1158 - ER_CONNECT_TO_MASTER

Appears when a replica cannot connect to its source. Check network, credentials, and SSL parameters.

FAQs

Do I need to stop both replication threads?

You only need to stop the IO thread for CHANGE MASTER TO but stopping both threads is safe and ensures consistency.

Will stopping the IO thread cause data loss?

No. The SQL thread keeps applying events already downloaded. New events are simply paused until the IO thread is restarted.

Can I automate the stop-change-start sequence?

Yes. Include STOP SLAVE IO_THREAD, CHANGE MASTER TO, and START SLAVE commands in your deployment scripts or Ansible playbooks.

How does Galaxy help avoid this error?

Galaxy’s AI copilot flags replication commands missing STOP SLAVE IO_THREAD in your SQL, and Collections let teams embed safe templates everyone can reuse.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo