X

MySQL 出現 Could not initialize master info structure 修復

於 MySQL 設定同步 Replication, 將下述命令拆成兩組輸入, 如下述:

  1. mysql> CHANGE MASTER TO MASTER_HOST='master.example.com', MASTER_USER='repl', MASTER_PASSWORD='repl_password';
  2. mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=107;

設定 Replication 完成後, start slave 無法啟動, 出現下述錯誤訊息:

Could not initialize master info structure, more error messages can be found in the MySQL error log

要怎麼解決呢?

MySQL Replication 出現 Could not initialize master info structure 修復

MySQL error log 看不出有什麼錯誤訊息, 可看此篇的討論: MySQL :: Could not initialize master info structure, more error messages can be found in the MySQL error log

下述直接寫解法:

  1. mysql> reset slave; # 重點就是這行
  2. mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=107; # 請依照自行環境設定
  3. mysql> start slave; # 就正常了.
  4. 註: 重新設置 slave, MASTER_LOG_FILE 和 MASTER_LOG_POS 會被清空, 所以需要重新設置.
Tsung: 對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活.
Related Post