首页 > 解决方案 > Problem with the phpMyAdmin ssl configuration

问题描述

I have a little problem with my PhpMyAdmin (i use NGINX & PHP 7.2). I wanted to configure the SSL connection between MySQL (MariaDB 10.2.27) and PhpMyAdmin by adding its information to the config.inc.php file:

$cfg['Servers'][$i]['ssl'] = true;
$cfg['Servers'][$i]['ssl_key'] = '/etc/mysql/ssl/server-key.pem';
$cfg['Servers'][$i]['ssl_cert'] = '/etc/mysql/ssl/server-cert.pem';
$cfg['Servers'][$i]['ssl_ca'] = '/etc/mysql/ssl/ca-cert.pem';
$cfg['Servers'][$i]['ssl_ca_path'] = '/etc/mysql/ssl';

But

now when I want to connect to PhpMyAdmin I get the error:

mysqli_real_connect(): (HY000/2006): MySQL server has gone away

Do you know why I have this error? Thank you in advance for your help.

标签: phpmysqlsslphpmyadmin

解决方案


You might be misunderstanding the ssl options in the pma config.

This does not encrypt traffic between your web browser and phpmyadmin, but rather the connection between phpmyadmin and your mysql server and it has to be set up on your mysql server.

AND you don't set an SSL certificate for phpMyAdmin for HTTPS - it is a web app - not a web server. Nginx stores the certificates and terminates/unwraps the SSL.

The HTTPS session you are using is between your PC and Nginx - it is nothing to do with phpMyAdmin. Your phpMyAdmin vhost is using whatever certificate you defined in Nginx.

HTTPS != SSL insofar as phpMyAdmin's configuration is concerned.

The setting you referred to is specifically for an SSL connection between phpMyAdmin and MySQL - which if is on localhost, isn't all too relevant anyway.

After all this question should goto : https://serverfault.com you are in wrong place.

See more : https://serverfault.com/questions/403006/phpmyadmin-with-ssl-https-and-mysql-client-on-nginx


推荐阅读