docker run -p 3307:3306 --name mysql-container -v /www/mysql/slave/log:/var/log/mysql -v /www/mysql/slave/data:/var/lib/mysql -v /www/mysql/slave/config/my.cnf:/etc/my.cnf -e MYSQL_ROOT_PASSWORD=Wenchen@xuan05186316 -e identified=mysql_native_password -d mysql:8.0.24
docker exec -it mysql-container
use mysql;
update user set host='%' where user='root' ;
grant all privileges on *.* to 'root'@'%' ;
flush privileges ;
select host from user where user='root';
alter user 'root'@'%' identified with mysql_native_password by 'Wenchen@xuan05186316';
select host, user, authentication_string, plugin from user
alter user 'root'@'%' identified with mysql_native_password by '123456';
docker run -d --name mysql-container -e MYSQL_ROOT_PASSWORD=123456 ?-p 3307:3306 -e identified=mysql_native_password mysql:8.0.24
create user 'slave21'@'%' identified with mysql_native_password by '1qaz@WSX3edc';
grant replication slave on *.* to 'slave21'@'%';
flush privileges;
show grants for 'slave21'@'%';
docker exec -it mysql-container mysql -u root -p
change master to master_host='172.17.0.1',master_user='slave21',master_password='1qaz@WSX3edc',master_log_file='mysql-bin.000022',master_log_pos=2900;
stop slave;
start slave;
show slave status \G