Home > Database > Mysql Tutorial > body text

How to solve the mysql error RSA private key file not found

PHPz
Release: 2023-05-28 10:34:06
forward
1628 people have browsed it

Error when installing mysql

[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.
Copy after login

The solution is as follows:

1. Check whether openssl is installed

$rpm -qa openssl

openssl-1.0.0-20.el6_2.5.x86_64
Copy after login

2. Use openssl to generate public and private keys

$ 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
Copy after login

3. Modify key permissions

$ chmod 400 mykey.pem
$ chmod 444 mykey.pub
chown mysql:mysql mykey.pem
chown mysql:mysql mykey.pub
Copy after login

4. Add the public and private key paths to my.cnf

sha256_password_private_key_path=mykey.pem
sha256_password_public_key_path=mykey.pub
如果key放在datadir目录下,直接写key名即可。否则要指定key的全路径
Copy after login

5. Restart 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-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEALeNX9dY4EMlaDHCIYPBvFNN
NJG2f6dtsyV/IG94TFsKtx/Xobiiz9ihBZSWvUhlfz6aVy9TbN68YEn58G5oOS3o
sxKZQvDF9XvjN0thDPwCgfIwTZgatqmrV/qGewCxQpQ03WHPx+GXQmM9iFSfM84F
pZ8QtiI3m+fIUaOd/QIDAQAB
-----END PUBLIC KEY-----

1 row in set (0.00 sec)
Copy after login

The above is the detailed content of How to solve the mysql error RSA private key file not found. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!