92.MySQL8.0在主从切换时需要注意的事项

1.密码认证方式的改变 

--首选需要执行这句。然后才能开启同步 
mysql> CHANGE MASTER TO GET_MASTER_PUBLIC_KEY=1;
Query OK, 0 rows affected, 2 warnings (0.02 sec)

stop slave ;
reset slave;
change master to
master_host='10.1.1.1.',
master_user='repl',
master_port=3300,
master_password='repl',
master_auto_position=1;

mysql> start slave; 
Query OK, 0 rows affected, 1 warning (0.02 sec)

mysql> show slave status\G

2.如果是新搭建的主从想用位置的方式同步

ERROR 1776 (HY000): Parameters SOURCE_LOG_FILE, SOURCE_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS 
cannot be set when SOURCE_AUTO_POSITION is active;
--关闭AUTO POSITION功能。
--change master to master_auto_position=0;

--如果首次执行同步:
change master to master_auto_position=0;

change master to
master_host='10.1.1.1',   --新主库。
master_user='repl',
master_port=3300,
master_password='repl',
master_log_file='binlog.000005',  
master_log_pos=237;

等到主从的GTID都同步了,后续的切换过程,则使用;master_auto_position=1; 去自动识别GTID.

  • 9
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值