兩臺(tái)服務(wù)器192.168.1.100(主服務(wù)器) 192.169.1.101(從服務(wù)器)
1、主服務(wù)器配置文件my.cn中增加
log-bin=MySQL-binserver-id=12、從服務(wù)器配置文件my.cnf中增加
server-id=23、主服務(wù)器上創(chuàng)建同步賬號(hào)
grant replication slave on *.* to repl@192.168.1.101 identified by 'repl';4、查詢主服務(wù)器日志同步節(jié)點(diǎn)
show master status;
5、從服務(wù)器設(shè)置同步開始點(diǎn),登陸mysql
change master to master_host='192.168.1.100',master_port= 3306, master_log_file='mysql-bin.000002', master_log_pos=450, master_bind='', master_user='repl',master_passWord='repl';6、開啟從庫同步數(shù)據(jù)
start slave;7、查詢從服務(wù)器狀態(tài)
show slave status /G;8、測(cè)試數(shù)據(jù)是否同步成功。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注