标签:log restart 连接 creat code str osi tin 查看
master
和 slave
上安装mysqldocker pull mysql
docker run -d --name godfunc-mysql -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 --restart=always mysql --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
/etc/mysql/my.cnf
master
配置和添加 slave
用户#配置 [mysqld] server-id = 1 log-bin = mysql-bin
-- 添加用户 CREATE USER ‘slave‘@‘%‘ IDENTIFIED BY ‘123456‘; GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO ‘slave‘@‘%‘;
slave
配置server-id = 2 log-bin = mysql-slave-bin relay_log=edu-mysql-relay-bin
mysql
服务docker restart godfunc-mysql
master
和 slave
master
的状态master
数据库中,执行下面的sqlshow master status
slave
, 连接 master
change master to master_host=‘172.17.0.2‘, master_user=‘slave‘, master_password=‘123456‘, master_port=3306, master_log_file=‘mysql-bin.000001‘, master_log_pos= 2830, master_connect_retry=30;
start slave
show slave status \G;
Last_IO_Error
的提示信息Slave_IO_Running: Yes Slave_SQL_Running: Yes
标签:log restart 连接 creat code str osi tin 查看
原文地址:https://www.cnblogs.com/Godfunc/p/10175511.html