MySQL Forums
Forum List  »  Perl

Strawberry Perl and TLS 1.2 connection error with DBD::mysql
Posted by: sesame technologies
Date: February 02, 2023 11:33PM

My company currently relies on ActivePerl for windows implementations, but are trying out Strawberry Perl. The only real problem we have hit is accessing MySQL when TLS 1.2 is required. We get the error "Can't connect to DB: TLS version used does not meet minimal requirements for this server. Please use a higher TLS version and retry".

The database I am trying to connect to is an Azure MySQL database that has a minimum of TLS 1.2 set.

Here is the test app I'm using as my test case:


use DBI;

my $ssl = 1; ## 1 = on, 0 = off

my $driver='mysql';
my $database = 'testdatabase';
my $hostname = '<host>';
my $port = '3306';
my $dbuid = '<user>';
my $dbpwd = '<password>';

if ($ssl == 1) {
$dbh = DBI->connect("DBI:$driver:$database;host=$hostname;port=$port","$dbuid","$dbpwd", {RaiseError => 0, mysql_ssl => 1, mysql_ssl_optional => 1}) or die ("Can't connect to DB: $DBI::errstr");
elsif ($ssl == 0) {
$dbh = DBI->connect("DBI:$driver:$database:$hostname","$dbuid","$dbpwd", {RaiseError => 0}) or die ("Can't connect to DB: $DBI::errstr");

print qq~
Connection Successful!

I've confirmed that if I setup the Azure MySQL instance to allow TLS 1.0 or TSL 1.1, the test program connects successfully, just not when TLS 1.2 is required (which is a regulatory requirement in this case).

I've tried Windows 2016 and 2019 to no avail and I'm using the latest version of Strawberry available. I can connect to another database with SSL disabled, so I know DBD::mysql is there and usable.

I have tried to specifically enable TLS 1.2 in the registry. My understanding is that is not necessary anymore for later versions of Windows, and that did not resolve the issue.

I'm at a loss and not sure how to get this working.

Options: ReplyQuote

Written By
Strawberry Perl and TLS 1.2 connection error with DBD::mysql
February 02, 2023 11:33PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.