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.