首页 > 数据库技术 > 详细

mysql5.7.21 主存复制

时间:2018-01-16 23:13:38      阅读:346      评论:0      收藏:0      [点我收藏+]

备份

PlUSH TABLES WITH READ LOCK;
mysqldump -u username -p --databases dbname2 dbname2 > weshop_test.sql
UNLOCK TABLES

恢复 mysql -uroot -p -h 127.0.0.1 -P23306  weshop_test <weishop_test.sql


master

[mysqld]

log_bin=master-bin
log_bin_index = master-bin.index
server-id=1
binlog_do_db=weshop_test
binlog_ignore_db = mysql
expire-logs-days=7

执行:

grant replication slave on *.* to ‘slave1‘ @‘%‘ identified by ‘123456‘;
show master status;

slave

[mysqld]
server-id=2
relay-log = slave-relay-bin
relay-log-index = slave-relay-bin.index

执行:

change master to master_host=‘master‘,master_port=3306,master_user=‘slave1‘,master_password=‘123456‘,master_log_file=‘master-bin.000002‘,master_log_pos=154
show satus status;

mysql5.7.21 主存复制

原文:https://www.cnblogs.com/anjunact/p/8297493.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!