1.grant replication slave,replication client on *.* to 'repli_user'@'192.168.0.5' identified by 'testpassword'mysql
2.配置主庫(log-bin,server-id,expire_logs_days=5)sql
3.利用主庫的備份構建備庫ide
4.在備庫上啓動複製(change master to,start slave)server
change master tossl
master_host='192.168.0.1',同步
master_port=3306,io
master_user='repl_user',ast
master_password='testpassword',test
master_log_file='mysql-bin.000045',cli
master_log_pos=107;
show slave status\G
start slave
設置從庫read_only=1
在主庫插數據而後在從庫上驗證同步是否正常
主庫上查看show processlist