於 MySQL 設定同步 Replication, 將下述命令拆成兩組輸入, 如下述:
- mysql> CHANGE MASTER TO MASTER_HOST=’master.example.com’, MASTER_USER=’repl’, MASTER_PASSWORD=’repl_password’;
- 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> reset slave; # 重點就是這行
- mysql> CHANGE MASTER TO MASTER_LOG_FILE=’mysql-bin.000001′, MASTER_LOG_POS=107; # 請依照自行環境設定
- mysql> start slave; # 就正常了.
- 註: 重新設置 slave, MASTER_LOG_FILE 和 MASTER_LOG_POS 會被清空, 所以需要重新設置.