Once you change the MASTER_HOST
, everything else needs to change with it.
The "dark back-alley" approach you just suggested is exactly what to do.
Warning: Some systems use "mysqld" versus "mysql".
The --skip-slave-restart "option" may not available without editing your
/etc/init.d/mysqld script to include this as a new option.
If used, it will still start the slave upon startup.</p>
On the Slave, run these four lines:
cd /var/lib/mysql
service mysql stop
cp master.info master.info.bak
wc -l < master.info
The last line echoes the number of lines in master.info
Next, vi master.info
and change the IP address.
Next, run wc -l < master.info
and make sure the linecount is still the same
Next, start mysql without starting replication
service mysql start --skip-slave-start
Login to MySQL, and run
SHOW SLAVE STATUS\G
If the IP address you added appears, then run
START SLAVE; SELECT SLEEP(5);
SHOW SLAVE STATUS\G
If you see Slave_IO_Running : Yes
and Slave_SQL_Running : Yes
, Congratulations !!!
Give it a Try !!!