mysql> CHANGE MASTER TO MASTER_HOST='192.168.10.151', MASTER_USER='repl', MASTER_PASSWORD='pass', MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=107;
ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log.
Slave 的中繼資料檔案 master.info、relay-log.info 損壞、遺留舊配置,或先前未正確 RESET SLAVE 導致元資料衝突。
STOP SLAVE;
/var/lib/mysql),刪除舊元資料:
cd /var/lib/mysql
rm -f master.info relay-log.info relay-log.* # 視情況保留 relay-log 目錄
RESET SLAVE ALL; -- 5.7.6+ 支援 ALL,清除 master.info、relay-log.info、複制位置、GTID 等
-- 舊版本用 RESET SLAVE;
CHANGE MASTER TO ... 並 START SLAVE;。
SHOW SLAVE STATUS\G
-- 確認 Slave_IO_Running=Yes, Slave_SQL_Running=Yes, Seconds_Behind_Master=0
STOP SLAVE; RESET SLAVE ALL; 清理舊狀態。master.info 檔案(權限、檔案鎖定風險),優先用 SQL 指令。CHANGE REPLICATION SOURCE TO 新語法(CHANGE MASTER TO 兼容保留)。