1.1.1. ERROR 1776 (HY000): ParametersMASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be setwhen MASTER_AUTO_POSITION is active.
【情况描述】
Mysql5.6.22搭建slave的时候,执行changemaster to …master_log_file…master_log_pos遇到报错:
mysql>
change master to
master_host='192.168.16.105',
master_user='repl',
master_password='repl',
master_log_file='mysql-bin.000006',
master_log_pos=1544;
ERROR 1776 (HY000): ParametersMASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be setwhen MASTER_AUTO_POSITION is active.
【产生原因】
Mysql5.6.5中添加了MASTER_AUTO_POSITION参数,当mysql开启了gtid功能的时候,默认MASTER_AUTO_POSITION=1开启状态的。
如果不使用GTID的方式来同步,使用传统的指定binary log文件名和位置的方式来同步,需要显示指定MASTER_AUTO_POSITION=0关闭状态:
mysql>
change master to
master_host='192.168.16.105',
master_user='repl',
master_password='repl',
master_log_file='mysql-bin.000006',
master_log_pos=1544,
MASTER_AUTO_POSITION=0;
同时,使用GTID方式同步的时候,必须指定MASTER_AUTO_POSITION=1:
change master to …MASTER_AUTO_POSITION=1;
【相关资料】
当mysql没有开启gtid的时候,默认MASTER_AUTO_POSITION=0关闭状态,change master to中不需要指定MASTER_AUTO_POSITION=0,如果指定了MASTER_AUTO_POSITION=1会遇到报错:
mysql>
change master to
master_host='192.168.16.105',
master_password='repl', master_user='repl',
master_log_file='mysql-bin.000010',
master_log_pos=120,
MASTER_AUTO_POSITION=1;
ERROR 1776 (HY000): ParametersMASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be setwhen MASTER_AUTO_POSITION is active.