#分别在master和slave上创建用户
create user slave identified by 'slave#mysql123';
grant replication slave,replication client on *.* to 'slave'@'192.168.1.%' identified by 'slave#mysql123';
flush privileges;
# 停止slave
STOP SLAVE IO_THREAD FOR CHANNEL '';
# 查看slave状态
show slave status\G;
# 查看master状态,用于设置slave【File、Position】
show master status\G;
# 在slave设置master
change master to master_host='192.168.1.12',master_user='slave',master_password='slave#mysql123',master_log_file='File',master_log_pos=Position;
# 开启slave
start slave;
binlog内容查看
mysqlbinlog -v --base64-output=DECODE-ROWS /home/log/mysql/bin-file.000448 | grep -A '20' 210812275
评论区