RSA private key file not found

mysql5.6二进制版本启动后,errorlog中出现如下错误:

[Note] RSA private key file not found: /db/mysql5.6/data//private_key.pem. Some authentication plugins will not work.
[Note] RSA public key file not found: /db/mysql5.6/data//public_key.pem. Some authentication plugins will not work.


解决方法如下:

1. 检查是否安装openssl
$rpm -qa openssl
openssl-1.0.0-20.el6_2.5.x86_64


2.利用openssl生成公有和私有key
$ openssl genrsa -out mykey.pem 1024
Generating RSA private key, 1024 bit long modulus
..........++++++
.++++++
e is 65537 (0x10001)


$ openssl rsa -in mykey.pem -pubout -out mykey.pub
writing RSA key

$ ll mykey*
-rw-r--r-- 1 db mysql 887 2014-10-26 12:59:05 mykey.pem
-rw-r--r-- 1 db mysql 272 2014-10-26 12:59:12 mykey.pub

3.修改key的权限
$ chmod 400 mykey.pem
$ chmod 444 mykey.pub


$ ll mykey*         
-r-------- 1 db mysql 887 2014-10-26 12:59:05 mykey.pem
-r--r--r-- 1 db mysql 272 2014-10-26 12:59:12 mykey.pub

 

4.把公私有key的路径加入到my.cnf中
sha256_password_private_key_path=mykey.pem
sha256_password_public_key_path=mykey.pub
如果key放在datadir目录下,直接写key名即可。否则要指定key的全路径。

 

5.重启mysql,SHOW STATUS查看Rsa_public_key状态,如果不为空,则OK.
mysql> SHOW STATUS LIKE 'Rsa_public_key'\G
*************************** 1. row ***************************
Variable_name: Rsa_public_key
        Value: -----BEGIN PUBLIC KEY-----
MIGfMA0ACSqGSIb2DQEBAQUAA4GNADCBiQKBgQDEnZaBWzo/4Ygm435LFKT8HBoX
bPkXATx9eJ4TWDtklLKidoWYj182fXdIpIA1Jt0CNm1MdLKwdcxuEOvSq/ortfmr
Y9doNlcpiLWUmDRD9LBH0AAJR1Tk7L8XLWEuq/nm3eiEnCUZE9+yF1gGxeDJQ2kG
oVHJhFxk0TST0R1nAQDDAQAB
-----END PUBLIC KEY-----
1 row in set (0.01 sec)

 

6.检查重启后的error log,相关的提示已经消失

参考文档:http://dev.mysql.com/doc/refman/5.6/en/sha256-authentication-plugin.html

展开阅读全文

没有更多推荐了,返回首页