MySQL基于SSL协议进行主从复制的详细操作教程

2019-01-04 16:59:43刘景俊

6、在从服务器上开始复制

change master to master_host='192.168.216.132', master_user='slave', master_password='slave', master_log_file='mysql-bin.000007', master_log_pos=1015, master_ssl=1, master_ssl_ca=' /usr/local/mysql/ssl/cacrt.pem', master_ssl_cert='/usr/local/mysql/ssl/slave.crt', master_ssl_key='/usr/local/mysql/ssl/slave.key'; start slave;

查看状态

20151223113001802.png (515×581)

错误1:

如果要确保证书没有问题可以通过建立测试的用户同ssl进行连接在主服务器上开一个权限很大的用户,进行ssl的登录测试

grant all privileges on *.* to root@'192.168.216.133′ identified by ‘root' require ssl; [root@slave ssl]# mysql -uroot -proot -h192.168.216.133 –ssl-ca=cacrt.pem –ssl-cert=slave.crt –ssl-key=slave.key
Warning: Using a password on the command line interface can be insecure. ERROR 2026 (HY000): SSL connection error: ASN: before date in the future

这是由于虚拟的时间不正确导致
如果这时候不使用ssl方式进行连接则会报出错误

[root@slave ssl]# mysql -uroot -proot -h192.168.216.133;
Warning: Using a password on the command line interface can be insecure. ERROR 1045 (28000): Access denied for user ‘root'@'192.168.216.132′ (using password: YES)

错误2:

在配置文件中添加证书配置后执行 show variables like ‘%ssl%'显示

20151223113020248.png (426×277)

这是由于没有将证书的属主改为mysql,可以从日志中得知是无权限获取私钥

20151223113037083.png (695×95)

您可能感兴趣的文章:

linux系统中使用openssl实现mysql主从复制多种不同的 MySQL 的 SSL 配置多种不同的 MySQL 的 SSL 配置mysql通过ssl的方式生成秘钥具体生成步骤mysql show processlist 显示mysql查询进程通过mysql show processlist 命令检查mysql锁的方法processlist命令 查看mysql 线程Apache、SSL、MySQL和PHP平滑无缝地安装apache+mysql+php+ssl服务器之完全安装攻略MySQL 使用 SSL 连接配置详解