背景: zabbix 数据库迁移,搭建主从,主是5.6.25,从是5.7.15,流式备份应用 redo.log 之后,change master 和reset slave 时报出如下错误
HANGE MASTER TO -> MASTER_HOST=‘192.168.40.129’, -> MASTER_USER=‘repl’, -> MASTER_PASSWORD=‘repl_123’, -> MASTER_PORT=3306, -> MASTER_LOG_FILE=‘mysql-bin.000005’, -> MASTER_LOG_POS=749, -> MASTER_AUTO_POSITION=0;ERROR 1794 (HY000): Slave is not configured or failed to initialize properly. You must at least set --server-id to enable either a master or a slave. Additional error messages can be found in the MySQL error log.
解决方法
drop 备份的 ibd表
use mysql
drop table slave_master_info;
drop table slave_relay_log_info;
drop table slave_worker_info;
drop table innodb_index_stats;
drop table innodb_table_stats;
重新导入
mysql> source /usr/local/mysql/share/mysql_system_tables.sql
Query OK, 0 rows affected, 1 warning (0.00 sec)
重启数据库
/etc/init.d/mysql restart