主:
master start;
show master status
FLUSH TABLES WITH READ LOCK
unlock tables;
reset master
reset slave;
reset slave all;
SHOW VARIABLES LIKE 'server_id';
set global read_only=off;
set global super_read_only=off;
show variables like '%log_bin%';
show processlist;
select @@GLOBAL.sql_mode;
GRANT REPLICATION SLAVE ON *.* TO 'wjx'@'%' IDENTIFIED BY 'q1w2e3r4';
FLUSH PRIVILEGES;
从:
set global sql_slave_skip_counter =1 ;
show SLAVE status
STOP SLAVE;
CHANGE MASTER TO
master_host = '192.168.0.200',#指定主库 IP 地址,可以通过 docker inspect 命令查看主IPAdress
master_port = 3306, #这个端口为主库容器内的 mysql 端口,不是宿主机映射容器的端口
master_user = 'wjx', #主库创建的复制用户
master_password = 'q1w2e3r4