配置Master
在[mysqld]加上
log-bin = master-bin
log-bin-index =master-bin.index
server-id=1
在master 上创建一个复制用户
create user repl_user;
grant replication slave on . to repl_user IDENTIFIED BY ‘1234’
配置SLAVE
在[mysqld]后加上
server-id = 2
relay-log-index = slave-replay-bin.index
relay-log = slave-relay-bin
master 上执行
change master to master_host=’192.168.199.218’,master_user=’repl_user’,master_password=’1234’,master_log_file=’mysql-bin.000004’,master_log_pos=107;
slave 上执行
change master to master_host=’192.168.199.193’,master_user=’repl_user’,master_password=’1234’,master_log_file=’mysql-bin.000007’,master_log_pos=107;