Passionate Development From Journeyman to Master

Stopping Replication on a MySQL Slave

This is just a quick note to self as I needed to stop replication on one of the MySQL slaves today.

Steps:

  1. Shut down master and slave
  2. Change slave’s my.cnf config file by adding skip-slave-status somewhere below the [mysqld] block
  3. Check if this works, by bring up the slave
  4. Connect to the server, and do show slave status\G
  5. If the replication has stopped the first line should just show Slave_IO_State: If it’s still replicating it will show: Slave_IO_State: Connecting to master

Above is the easiest way to stop replication. Alternatively you could also comment out the master-* lines on the slave’s my.cnf, but just be aware when you do this you’d also need to delete/rename master.info file. Master.info contains the “cached” information of the database master, the master-* values on my.cnf will be ignored when this file is found.

misc