// shall I write some keywords here to boost search engine ranking?

Tuesday, August 05, 2008

MySQL Problem: Changes in my.ini do not reflect in replication

In order to setup replication, we may configure the master host details in slave DB 'my.ini' file. Example of configuration is as below:

master-host=10.0.0.112
master-port=3306
master-user=repl_user
master-password=password123
master-connect-retry=60
report-host=slaveHostName
However, after replication started, if you change the master host information in my.ini, it will not take effect after you restart the slave, not even you restart your MySQL.

This is because once MySQL replication started, it will generate a file 'master.info' in MySQL data folder. If this file was found when starting replication slave, replication will start based on 'master.info' and ignore the replication options configure in 'my.ini'.

So besides changing the 'my.ini', you should also issue a CHANGE MASTER TO command.

The steps are:
i) stop slave;
ii) CHANGE MASTER TO ...
iii) start slave.;

No comments: