Docker搭建mysql主从
master-mysql
添加配置文件
master创建数据同步用户
CREATE USER 'slave'@'%' IDENTIFIED BY '123456';
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'slave'@'%';
show master status;
master_log_file='mall-mysql-bin.000001'
master_log_pos=617
slave-mysql
从数据库配置主从复制
change master to
master_host='宿主机ip',
master_user='slave',
master_password='123456',
master_port=3307,
master_log_file='mall-mysql-bin.000001',
master_log_pos=617,
master_connect_retry=30;
从数据库开启主从同步
start slave;
Docker安装mysql主从复制
最新推荐文章于 2024-10-24 02:45:00 发布