mysql_ssl is not a handle attribute. If you try to use it like one, it's ignored, which you can see by turning on tracing:
use strict;
use warnings;
use DBI;
DBI->trace('1|CON');
my $dsn = 'DBI:mysql:test';
my $dbh = DBI->connect($dsn, 'foo', '', {
PrintError => 0,
RaiseError => 1,
mysql_ssl => 0 # equivalent to $dbh->{mysql_ssl} = 0
});
Output:
DBI 1.627-ithread default trace level set to 0x200/1 (pid 30834 pi 1d0e010) at db line 8
-> DBI->connect(DBI:mysql:test, foo, ****, HASH(0x1d3b550))
-> DBI->install_driver(mysql) for linux perl=5.016003 pid=30834 ruid=12011 euid=12011
install_driver: DBD::mysql version 4.023 loaded from /usr/lib64/perl5/vendor_perl/DBD/mysql.pm
<- install_driver= DBI::dr=HASH(0x1e33a10)
!! warn: 0 CLEARED by call to connect method
-> connect for DBD::mysql::dr (DBI::dr=HASH(0x1e33a10)~0x1e33bf0 'test' 'foo' **** HASH(0x1e4d808)) thr#1d0e010
<- connect= ( DBI::db=HASH(0x1f65fe0) ) [1 items] at DBI.pm line 670
<- STORE('RaiseError', 1)= ( 1 ) [1 items] at DBI.pm line 722
<- STORE('PrintError', 0)= ( 1 ) [1 items] at DBI.pm line 722
<- STORE('AutoCommit', 1)= ( 1 ) [1 items] at DBI.pm line 722
<- STORE('Username', 'foo')= ( 1 ) [1 items] at DBI.pm line 725
$h->{'mysql_ssl'}=0 ignored for invalid driver-specific attribute
Instead, add it to the DSN:
my $dsn = 'DBI:mysql:test;mysql_ssl=0';
my $dbh = DBI->connect($dsn, 'foo', '', {
PrintError => 0,
RaiseError => 1
});
Depending on the server configuration, you may still have issues (like if the server is configured to require SSL).