1. master主机添加slave用户:
执行 grant replication slave,reload,super on *.* to [email protected]‘127.0.0.1‘ identified by ‘123456‘
注:该命令新建用户账号backup、密码123456,并直接赋权限;
2. 修改master的my.ini,并重启:
在[mysqld]下添加
server-id=10
log-bin=D:\mysql-5.5\log\log-bin.log
3. 修改slave的my.ini, 并重启:
在[mysql]下添加
server-id=20
log-bin=mysql=bin
relay-log=relay-bin
relay-log-index=relay-bin-index
4. 在slave中执行:
stop slave;
change master to master_host=‘127.0.0.1‘,master_user=‘backup‘,master_password=‘123456‘;
start slave;
5. 执行show slave status\G; 查看链接状态
时间: 2024-11-06 01:54:06