mysql主从配置--windows

主数据库 10.10.16.199
1、开启主从库的远程设置
设置 my.ini文件中
bind-address = 0.0.0.0
2、设置账号权限
GRANT REPLICATION SLAVE,RELOAD,SUPER ON . to ‘root’@‘192.168.116.140’ identified by ‘Ufsoft123’;
FLUSH PRIVILEGES;
3、主从配置
server-id=1 //整数即可
log-bin=log // 存放日志路径
binlog-do-db=iv2 // 数据库名称
4、记录下这连个状态值

在这里插入图片描述
从数据库 10.10.16.151
设置my.ini文件
server-id=88 //唯一整数即可
replicate-do-db=iv2 //数据库名称
执行命令
关闭
stop slave;
设置主从
change master to master_host=‘10.10.16.199’,
master_user=‘root’,
master_port=3306,
master_password=‘Ufsoft123’,
master_log_file=‘log.000004’, // 查看主数据库状态 File
master_log_pos=120; // 查看主数据库状态 Position
开启
start salve;
查看状态是否成功

在这里插入图片描述

出现的错误:
1、Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs;
主从数据库的uuid相同,修改data文件夹下的auto.cnf文件
2、导致lave_IO_Running 为connecting 的原因主要有以下 3 个方面:
1、网络不通 2、密码不对 3、pos不对
注意:1、已管理员身份运行cmd,执行installService.bat

发布了17 篇原创文章 · 获赞 7 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/xiangwangye66/article/details/83149174