Mysql 主从复制

1、/etc/my.cnf 添加

server-id=1

log-bin=master-bin

log-bin-index=master-bin.index

 

2、登陆主机mysql

1) grant replication slave on *.* to 'root'@'192.168.50.180' identified by 'Kdgcsoft2017';

2) flush privileges;

3) show master status;

 

 

从:

1、vi /etc/my.cnf

server-id      = 33                                                        //修改    此处ID只要比Master大就可以

relay-log=relay-log-bin                                                    //增加

relay-log-index=slave-relay-bin.index                          //增加

修改完成之后重启mysql服务:service mysqld restart

 

 

 

 

 

 

 

 

 

 

 

 

 

2、这是我自己配置的,其中master_user 是我在测试读写分离时创建的主从共有的用户和密码

change master to master_host='192.168.50.184',master_user='root',master_password='uum_admin_master',master_log_file='master-bin.000008',master_log_pos=2776;

 

 

问题:

1、出现了Slave_IO_Running: Connecting 这个问题,

1.)网络不通

2.)密码不对

3.)pos不正确

4.)ID问题

2、MySQL 5.6 Warning: Using a password on the command line interface can be insecure

 

3、ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

1)set global validate_password_length=1;

2)set global validate_password_mixed_case_count=2;

3)set global validate_password_policy=0;

 

二、mysql-proxy 读写分离(未实现)

1、

mysql-proxy  --daemon --log-level=debug --log-file=/var/log/mysql-proxy.log --plugins="proxy" --proxy-backend-addresses="192.168.50.184:3306" --proxy-read-only-backend-addresses="192.168.50.180:3306"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值