Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Feb 252010
 

Change MySQL replication master host

Answer:

To change the MySQL replication master host from a MySQL slave, follow the steps below.

1. Copy current master bin log file name and position

mysql> STOP SLAVE;
mysql> SHOW SLAVE STATUS\G

You will find something like the following...

Master_Log_File: mysql-bin.000081
Read_Master_Log_Pos: 3684056824

2. Change to new master using command

mysql> CHANGE MASTER TO MASTER_HOST='192.168.1.2', MASTER_LOG_FILE='mysql-bin.000081', MASTER_LOG_POS=3684056824;
mysql> START SLAVE;

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>