主從從結構:服務器
主服務器:ide
1:開啓binlog日誌,設置server_id號日誌
2:用戶受權:server
grant replication slave on *.* to 用戶名@'ip地址' identified by ‘密碼’;blog
3:重啓服務便可進程
從1服務器:ip
1:開啓binlog日誌,設置server_id號it
2:開啓容許(聯級複製) log_slave_updatesio
3: 用戶受權 grant replication slave on *.* to 用戶名@'ip地址' identified by ‘密碼’;ast
4:指定主服務器
change master to master_hos="192.168.2.11", master_user="repluser", master_password="Ahao...520", master_log_file=" ", master_log_pos= ;
5:開啓slave進程
start slave
6:檢查狀態
show slave status\G;
Slave服務器:
1:設置server_id號
2:指定主服務器
change master to master_hos="192.168.2.11", master_user="repluser", master_password="Ahao...520", master_log_file=" ", master_log_pos= ;
3:開啓Slave進程
4:重啓服務