2012-04-04

Database Replication with MySQL5.5.x on Windows

On master server :
In section [mysqld] of my.cnf/my.ini file add :
server-id=1
binlog-do-db='database1_to_replicate'
binlog-do-db='database2_to_replicate'
...
binlog-do-db='databaseN_to_replicate'


Then start the master server and connect to it to create the account that will be used for the replication process :
CREATE USER 'repl_login'@'server_address' identified by 'repl_password';
GRANT REPLICATION SLAVE ON database1_to_replicate.* to 'repl_login'@'server_address';


On the slave :
In section [mysqld] of my.cnf/my.ini file add :
server-id=2

Start the slave, connect to it and type :
STOP SLAVE;

Define the master server with the following command :
CHANGE MASTER TO MASTER_HOST='server_address', MASTER_USER='intratool_repl', MASTER_PASSWORD='intratool_repl', MASTER_PORT=server_port;

Start the slave process :
START SLAVE;

Repeat theses command if you need to add other slave server.