赞
踩
//创建同步账号并授权
create user 'cluster_user'@'%' identified by '您的密码';
grant replication slave on *.* to 'cluster_user'@'%'
flush privileges;
//修改配置文件(见下图)
vi /etc/my.cnf
server-id = 1
log-bin = mysqlbk-bin
binlog_format = MIXED
systemctl restart mysqld.service
//查看主库状态
msyql-> show master status;
//修改配置文件(见下图)
vi /etc/my.cnf
server-id = 2
relay-log = relay-log-bin
relay-log-index = slave-relay-bin.index
systemctl restart mysqld.service
mysql -u root -p
change master to
master_host='主服务器IP',
master_user='用于同步数据库的账号',
master_password='同步账号密码',
master_log_file='主库中的日志文件file',
master_log_pos=主库中的日志文件position;
//开启从服务功能
start slave;
//查看从服务状态
show slave status\G
stop slave;
reset master;
参考https://blog.csdn.net/weixin_44048054/article/details/131657673
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。