Here’s a little post on how to change the master database host that the replication slave in a MySQL replication setup uses. This can happen if there is a change in network addresses or when you want to switch over to using different internal network. The main thing to keep in mind is that when you change the replication user host on the slave MySQL will think that you are now replicating from a different database. Therefore we need to force MySQL to continue replicating the changes where it left off before the change.
First we need to create a new user on the master database server with the new IP address like this:
The rest of the operations are on the replication slave. We need to stop the replication and figure out where to restart the replication after changing the user:
From the slave status pick out the 2 settings for Master_Log_File and Read_Master_Log_Pos. Those items will look something like this:
Those settings need to be used in the following statement:
start slave command starts the replication again. Make sure you do a
show slave status afterwards to make sure that replication is running again without errors.