1.在主服務(wù)器上,備份數(shù)據(jù)庫
mysqldump -uroot -p111111 --master-data -B game ucenter uchome ihompy > ihompy.sql
備份數(shù)據(jù)庫,注意必需帶--master-data參數(shù)。
2.在從服務(wù)器上的mysql內(nèi):
stop slave
停止從服務(wù)器的數(shù)據(jù)更新。
3.導(dǎo)入備份數(shù)據(jù)庫到從服務(wù)器內(nèi):
mysql -h 10.11.12.26 -uroot -p111111 < ihompy.sql
4.看導(dǎo)入是否成功
比對show slave status和head -n 50 ihompy.sql內(nèi)的MASTER_LOG_FILE及MASTER_LOG_POS是否相同。相同說明導(dǎo)入OK。
5.啟動從服務(wù)器:
start slave
再用show slave status看看是否有報錯,MASTER_LOG_POS是否有變化,無報錯,有變化說明配置成功了。
---★ 本文轉(zhuǎn)摘自『IT學(xué)習(xí)者』→ http://www.itlearner.com/article/4817