There might be a time that you no longer need a MySQL slave in your replication setup. You can remove a mysql replication slave using the following instructions.
Log in to your mysql slave and make sure that nothing is accessing the slave database.
Run the following commands.
12345 | mysql> STOP SLAVE; mysql> CHANGE MASTER TO MASTER_HOST=' '; mysql> RESET SLAVE; |
Note: There is a space between the apostrophes.
You will then need to remove the Slave configuration from your mysql configuration file (my.cnf). You will need to comment out or remove any line that has the following:
- server-
- master-
- relay-
1 | vi /etc/my.cnf |
Restart mysql to reload the configuration.
1 | service mysqld restart |
You can test that the slave is disabled by checking the slave status and it returns an empty set. .
12 | mysql> SHOW SLAVE STATUS \G Empty set (0.00 sec) |
After the slave is completely offline you might want to remove the database that was replicating so you can go ahead and drop the replicated database and ensure the slave is clean.
1 | mysql> DROP DATABASE databasename; |
MySQL replication is now completely disabled and the server is clean of any data you might have replicated to it.