MySQL Replication

August 2, 2007 by hejian

Master’s my.cnf

server-id=1
log-bin=mysql-bin
binlog-do-db=db1
binlog-do-db=db2
sql-bin-update-same

Slave’s my.cnf

server-id=2
log-bin=mysql-bin
binlog-do-db=db1
binlog-do-db=db2
master-host=host
master-user=username
master-password=password
master-port=3306
master-connect-retry=60
log-slave-updates

Replication User

GRANT REPLICATION SLAVE ON *.* TO 'user'@'host' IDENTIFIED BY 'password';

Check Master

show master status;

Position must not be 0.


show processlist;

Be careful with the State of Binlog Dump.

Check Slave

show master status;

Position must not be 0.


show slave status;

Slave_IO_Running and Slave_SQL_Running must be Yes.


show processlist;

Be careful with the State of Connect.

Other Command on Slave

START SLAVE

Let the slave creates an I/O thread and start replicateion.

Leave a Reply

You must be logged in to post a comment.

Wordpress template made by HeJian