I used replication to migrate all data to a new server, and then I commented out master_host,master_port etc(basically all lines related to master) in my.cnf, I issued stop slave.
However I after restarted mysqld, the replication process is running again! how to stop it for good.

4 Answers 4


The proper way to do this is stop slave; reset slave;

The 'reset slave' is the part that will wipe the config and keep it from reconnecting.

  • is the config stored in the database?
    – user12145
    Feb 10, 2011 at 2:46
  • I'm not sure. I believe part of it is stored in master.info as lynxman mentioned, but this command controls that file (at least thats what the doc says). Anyway I've used it and its worked for me.
    – phemmer
    Feb 10, 2011 at 3:56
  • This is not correct anymore - see serverfault.com/a/788912/299496
    – Eborbob
    Jul 29, 2016 at 14:32

The procedure is different based on the MySQL server version.

  • For version 5.0 and 5.1, run STOP SLAVE, CHANGE MASTER TO MASTER_HOST='' and then RESET SLAVE.

In these versions the RESET SLAVE command will remove files master.info and relay-log.info and most of the settings, however some of the settings will just be reset to default values and this is dangerous. If replication is started again, it will start without knowing the master position and so would re-apply all the logs still still available on the master. To to correctly remove all the info about master you need to run also the CHANGE MASTER command.

  • For versions 5.5, 5.6 and 5.7 it is easier, just run STOP SLAVE and then RESET SLAVE ALL.

Here the RESET SLAVE (without the ALL keyword) behaves in the same way - not removing all the info. However also the CHANGE MASTER doesn't help for 5.5+, so you have to be careful and know on which MySQL version you are currently working.

  • RESET SLAVE ALL - the ALL is what I was missing, thanks! :) Apr 21, 2018 at 10:23

In order to completely stop replication you have two ways

  • Issue a 'CHANGE MASTER` command with fake info, that'll break the replication for good
  • Remove the file master.info that sits on root of your mysql, that'll remove replication info

In any of those cases you'll need to redo your replication later, write down all the replication data like last position and last source-bin file just in case you want to start replication again.

  • no master.info is found on my system
    – user12145
    Feb 10, 2011 at 3:05
  • Can a "master.info" file be deleted safely from a running master-DB. I know it's supposed to be there on a slave, but it's a left-over from an import where "CHANGE MASTER" was set on the master...
    – Henk
    May 23, 2011 at 15:11

I usually do an STOP SLAVE; CHANGE MASTER TO MASTER_HOST=''; to kill off a slave.

  • This no longer works. I get Incorrect arguments to MASTER_HOST on mysql 5.5.38
    – Shoan
    Sep 4, 2014 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.