配置
master
conf/my.cnf
[mysqld]
server-id=101
log-bin=mysql-bin
binlog-do-db=myserver
binlog-do-db=myserver2
slaver
conf/my.cnf
[mysqld]
server-id=102
log-bin=mysql-bin
replicate-do-db=myserver
操作
master
set sql_mode=(select replace(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
grant replication slave on *.* to 'backup'@'%' identified by '123456';
show master status;
slaver
set sql_mode=(select replace(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
change master to master_host='192.168.88.203',master_port=3306,master_user='backup',master_password='123456',master_log_file='mysql-bin.0000003',master_log_pos=439;
start slave;
show slave status\G;
停止从服务
stop slave;