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.
The procedure is different based on the MySQL server version.
- For version 5.0 and 5.1, run
CHANGE MASTER TO MASTER_HOST=''and then
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 SLAVEand then
RESET SLAVE ALL.
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.
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.infothat 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.