Try this out and see it works better. The connect method is not documented to accept a DSN in that format.
#!/usr/bin/perl use strict; use warnings; use v5.10; use DBI; say "Perl MySQL Connect Demo"; my $db = 'db'; # or whatever it really is my $server = 'server'; # ditto my $dsn = "DBI:mysql:database=$db;host=$server"; my $username = "user"; my $password = 'password'; my $dbh = DBI->connect($dsn,$username,$password);
See also DBD::mysql Class Methods for the full documentation on connect.
Update: You may also need to add in the port.
Update 2: You may need to set some MySQL specific variables in order to get a secure connection working.
<code>... my $port = 12345; # whatever is should be my $dsn = "DBI:mysql:database=$db;host=$server;port=$port; mysql_ssl=1; mysql_ssl_client_key=/var/lib/ssl/client-key.pem; mysql_ssl_client_cert=/var/lib/ssl/client-cert.pem; mysql_ssl_ca_file=/var/lib/ssl/cacert.pem"; # Your paths may vary... ...
In reply to Re: Connection to mysql database fails when using SSL
by Mr. Muskrat
in thread Connection to mysql database fails when using SSL
by wthebutcher
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |