MySQL – Exclude or Delete .pem Files in Backup Data

command lineMySQLwindows

I am making a backup of the mysql data folder. In this folder are the databases. The method I am using is described in this post which uses ROBOCOPY

During installation, mysql (tested in 5.7.30) generates the following .pem files by default (at least in the wampserver version. I'm not sure if in the other versions):

private_key.pem
public_key.pem
server-cert.pem
server-key.pem
ca-key.pem
client-cert.pem
client-key.pem

the question is: What happens if I don't backup these files or delete them?

tests performed:
I have stopped the mysql service and I have removed all the .pem files and when I start mysql again only these .pem files appear

private_key.pem
public_key.pem

What about the rest?

thanks

Best Answer

They are needed for the mysql to generate nbew ssl keys

So to answer your question

You have to decide if you want ssl or not, so if you use ssl and have user created some client certificates with it you need it, if not you don't need them.

When you active ssl in my.ini

like

ssl=1
ssl-ca="\sslfolder\ca-cert.pem"
ssl-cert="\sslfolder\server-cert.pem"
ssl-key="\sslfolder\server-key.pem"

you can allow a user only to access via ssl

First you generate a new ssl certificate for a user exampleuser

and add like this the use of ssl

CREATE USER 'exampleuser'@'localhost' IDENTIFIED BY 'secretsparrworf' REQUIRE X509;
GRANT ALL PRIVILEGES ON *.* TO 'exampleuser'@'localhost';

fionaööy you can access mysql via ssl like this

mysql -u exampleuser-p --ssl-ca=ca-cert.pem --ssl-cert=client-cert.pem --ssl-key=client-key.pem