码迷,mamicode.com
首页 > 数据库 > 详细

mysql5.7.21 主存复制

时间:2018-01-17 00:19:56      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:databases   mysq   cat   mysqldump   恢复   dbn   master   day   备份   

备份

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 主存复制

标签:databases   mysq   cat   mysqldump   恢复   dbn   master   day   备份   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!