您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

MySQL-主从配置

bubuko 2022/1/25 20:04:25 mysql 字数 1445 阅读 753 来源 http://www.bubuko.com/infolist-5-1.html

1. 配置同步账号 create user 'sync'@'192.168.10.%' identified by 'sync'; grant replication slave on *.* to 'sync'@'192.168.10.%'; flush privileges; 2. 开启binl ...

 

1. 配置同步账号

create user ‘sync‘@‘192.168.10.%‘ identified by ‘sync‘;
grant replication slave on *.* to ‘sync‘@‘192.168.10.%‘;
flush privileges;

2. 开启binlog

# /etc/my.cnf增加一下配置
# open binary log mode
log_bin = /mydata/binlog
binlog-format = ROW

3. 初始化

mysqldump --single-transaction -uroot -hmaster -P3308 --master-data=2 -A |mysql -uroot -hslave -P3308

4. 配置主从同步

mysql -uroot -hmaster -P3308 -e " CHANGE MASTER TO MASTER_HOST=‘192.168.10.181‘, MASTER_USER=‘sync‘, MASTER_PASSWORD=‘sync‘, MASTER_PORT=3306; "

5. 启动服务

-- 开启主从
start slave;

6. 检查确认

show slave status\G;
show master status\G;

MySQL-主从配置

原文:https://www.cnblogs.com/binliubiao/p/12523527.html


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶