Convert MySQL Slave to Master

Convert MySQL Slave to Master

If you ever have some sort of major failure, or you are just testing your fail over capabilities, you have have ran into a scenario where you need to change your MySQL Slave to a master.

** WE TAKE ZERO RESPONSIBILITY FOR ANY DATA LOSS, YOU ARE ON YOUR OWN WITH THIS **

we are also assuming at this point that you have only one master replicating to only one slave.

login and SU to root

the first thing to do is make sure the slave you are about to make the master is current/up to date, otherwise you could be in a real pickle

perfect! Waiting for master, zero seconds behind, and no errors. We can proceed.

Step1) Flush logs on master

2) Slave Conversion

from here we stop slave, and reset master

the following command now tells the MySQL server that it’s the master

this MySQL slave is now showing as the master

from here, it’s up to you to re-configure as slaves, or what is best for your environment presently. I would change some CNAME’s around on your internal DNS as well if this is permanent/production impacting.

That’s it!

Hosted Linux at www.zwiegnet.com/go