Olega
6 months ago
376
0
Servers

Enable mysql ssl

Posted 6 months ago by Olega

Hi, i need to enable SSL and Remote Connections for MySQL. I am doing it like this:


'options' => extension_loaded('pdo_mysql') ? array_filter([
  PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_CA'),
  PDO::MYSQL_ATTR_SSL_KEY => env('MYSQL_KEY'),
  PDO::MYSQL_ATTR_SSL_CERT => env('MYSQL_CERT'),
  PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
]) : [],

But i am getting:

 PDOException::("PDO::__construct(): Peer certificate CN=`MySQL_Server_8.0.18_Auto_Generated_Server_Certificate' did not match expected CN=`10.100.2.3`

10.100.2.3 - mysql server

How can i solve it?

P.S.

it works

mysql -u admin -p -h 10.100.2.3 --ssl-ca=ca.pem --ssl-cert=client-cert.pem --ssl-key=client-key.pem

Please sign in or create an account to participate in this conversation.