It’s not uncommon to promote a server from slave to master. One of the key things to protect your data integrity is to make sure that the promoted slave is permanently disconnected from its old master. If not, it may get writes from the old master, which can cause all kinds of data corruption. MySQL provides the handy
RESET SLAVE command. But as we’ll see, its behavior has changed along with the MySQL versions and it’s easy to shoot yourself in the foot if you use it incorrectly. So how do you safely disconnect a replication slave?
- For MySQL 5.0 and 5.1, run
CHANGE MASTER TO MASTER_HOST=''and then
- For MySQL 5.5 and 5.6, run
STOP SLAVEand then