replication配置过程
1.grant replication slave,replication client on *.* to 'repli_user'@'192.168.0.5' identified by 'testpassword'
2.配置主库(log-bin,server-id,expire_logs_days=5)
3.利用主库的备份构建备库
4.在备库上启动复制(change master to,start slave)
change master to
master_host='192.168.0.1',
master_port=3306,
master_user='repl_user',
master_password='testpassword',
master_log_file='mysql-bin.000045',
master_log_pos=107;
show slave status\G
start slave
设置从库read_only=1
在主库插数据然后在从库上验证同步是否正常
主库上查看show processlist