Linux配置mysql5.6数据库支持SSL加密
1、MYSQL数据库文件目录下生成
cd /www/server/data/ openssl genrsa 2048 > ca-key.pem openssl req -new -x509 -nodes -days 3600 -key ca-key.pem -out ca.pem openssl req -newkey rsa:2048 -days 3600 -nodes -keyout server-key.pem -out server-req.pem openssl rsa -in server-key.pem -out server-key.pem openssl x509 -req -in server-req.pem -days 3600 -CA ca.pem -CAkey ca-key.pem -set_serial 01 -out server-cert.pem openssl req -newkey rsa:2048 -days 3600 -nodes -keyout client-key.pem -out client-req.pem openssl rsa -in client-key.pem -out client-key.pem openssl x509 -req -in client-req.pem -days 3600 -CA ca.pem -CAkey ca-key.pem -set_serial 02 -out client-cert.pem openssl verify -CAfile ca.pem server-cert.pem client-cert.pem
2、配置mysql配置文件
[mysqld] 下增加
ssl-ca=/www/server/data/ca.pem ssl-cert=/www/server/data/server-cert.pem ssl-key=/www/server/data/server-key.pem
重启MYSQL,再查询
show variables like %have_ssl% 结束是否ON 或 YES 等 表示开启字样
微信扫码添加微信好友