DBD-MySQL with SSL

Posted by monkeyk on 2018-03-17 09:18

Has anyone gotten DBD::MySQL to work with SSL in ActiveState Perl? I have the following code:

use warnings;
use strict;
use DBI;

my $dbname = "database";
my $host = "127.0.0.1";
my $port = "3306";
my $user = "username";
my $pass = "password";
my $cakey = "ca-cert.pem";
my $clientkey = "win-key.pem.nopass";
my $clientcert = "win-cert.pem";

my $dsn = DBI->connect("dbi:mysql:dbname=$dbname;host=$host;port=$port;mysql_ssl=1;mysql_ssl_ca_file=$cakey;mysql_ssl_client_key=$clientkey;mysql_ssl_client_cert=$clientcert","$user","$pass",
{AutoCommit => 0}) or print "Error opening database: $DBI::errstr\n";

my $ssl_check = $dsn->prepare("SHOW STATUS LIKE 'ssl_cipher'")
or print "SSL Status Check Failed: $DBI::errstr\n";

$ssl_check->execute()
or print "Execute SSL Status Check Failed: $DBI::errstr\n";

my @ssl_value = $ssl_check->fetchrow_array;

print "SSL Connection Value: ", $ssl_value[0], " : ", $ssl_value[1], "\n";

On my Linux box I compiled DBD::MySQL with -ssl and the connection works, printing out:
SSL Connection Value: Ssl_cipher : DHE-RSA-AES256-SHA

On my Windows box with ActiveState perl, the exact same code fails and just prints:
SSL Connection Value: Ssl_cipher :

It appears as though ActiveState's version of DBD::MySQL does not include SSL support.

I am currently running ActivePerl 5.12.3 Build 1024.

Has anyone gotten SSL working with DBD::MySQL in ActiveState perl?