Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting phpMyAdmin to a MySQL server over SSL

I may be barking up the wrong tree... However, what I have is a MySQL server that accepts connections only from a client with a valid SSL cert (see this link). This works great for example with Rails. I have my database on one server, and a Rails app that connects using the client certificate. Maybe not the fastest, but it works.

The configuration in database.yml looks something like this:

sslkey: /path/to/client-key.pem
sslcert: /path/to/client-cert.pem
sslca: /path/to/ca-cert.pem

The problem is that I'd like to host phpMyAdmin on the same server as the Rails app. I think that phpMyAdmin is simply more limited in its connection options because I can't seem to find a way for it to use a client certificate to connect. But what I found odd was that Googling for answers didn't turn up much on this subject (which makes me wonder if I'm taking the wrong approach to this).

Obviously, I can easily set up phpMyAdmin itself to be hosted behind an SSL certificate (which will encrypt requests between the client browser and my phpMyAdmin server) but I want the phpMyAdmin <-> db connection to be encrypted as well.

Is this possible? Is this a bad design choice? Are there better ways to do this?

like image 208
5 revs, 3 users 96% Avatar asked Dec 22 '22 13:12

5 revs, 3 users 96%


1 Answers

in your config.inc.php add this line after applicable server stuff:

$cfg['Servers'][$i]['ssl']=true;  

Assuming your php and its mysql client is configured with SSL in mind this should work.

like image 100
Stepan Mazurov Avatar answered Jan 02 '23 21:01

Stepan Mazurov