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.

- 1,115
- 6
- 28
- 47
4 Answers
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 thenRESET 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 thenRESET 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.

- 1,538
- 1
- 14
- 27
-
`RESET SLAVE ALL` - the `ALL` is what I was missing, thanks! :) – Jovan Perovic Apr 21 '18 at 10:23
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.

- 5,909
- 2
- 27
- 36
-
-
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 '11 at 03:56
-
This is not correct anymore - see http://serverfault.com/a/788912/299496 – Eborbob Jul 29 '16 at 14:32
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.

- 9,397
- 3
- 25
- 28
-
-
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 '11 at 15:11
I usually do an STOP SLAVE; CHANGE MASTER TO MASTER_HOST='';
to kill off a slave.

- 889
- 1
- 9
- 19
-
1This no longer works. I get `Incorrect arguments to MASTER_HOST` on mysql 5.5.38 – Shoan Sep 04 '14 at 01:52