in reply to DBI:mysql connection over SSL fails

G'day Andre_C10002,

Welcome to the monastery.

I'm not in a postion to test this, but one problem may be all the embedded spaces and newlines in your DSN. Try writing it more like this:

my $dbh = DBI->connect(join('', 'DBI:mysql:database=_DATABASE_;host=_HOST_;', qw{ mysql_ssl=1; mysql_ssl_client_key=/etc/mysql/certs/client-key.pem; mysql_ssl_client_cert=/etc/mysql/certs/client-cert.pem; mysql_ssl_ca_file=/etc/mysql/certs/ca-cert.pem } ), '_SSL_USER_', '_SSL_USER_PWD_' ) || die DBI->errstr;

Another potential issue is what you really have for the placeholders you show (e.g. '_SSL_USER_PWD_'). If any of those are (or evaluate to) strings with special characters (e.g. "pass$word"), you may need to escape the special characters. There's several ways of doing this depending how you're actually getting that data into connect(). Some examples: "pass\$word", 'pass$word', q{pass$word}, "\Q$variable_holding_password\E".

-- Ken

Replies are listed 'Best First'.
Re^2: DBI:mysql connection over SSL fails
by Andre_C10002 (Initiate) on May 09, 2014 at 13:57 UTC

    Thank you, Ken.

    Unfortunately, the syntax change to use "qw" didn't help.

    On the '_SSL_USER_' and '_SSL_USER_PWD_' values, I shouldn't have problems as they are enclosed on single quotes, therefore shouldn't be evaluated. Anyway, I escaped whatever chars could cause problems with no luck.

    Cheers,

    André

      "Unfortunately, the syntax change to use "qw" didn't help."

      Just checking that you did notice that involved more than just qw{}.

      joining without intervening whitespace was the main point; qw{} was of lesser importance and could've been implemented in other ways.

      join('', 'DBI:...', qw{...})

      -- Ken

        Yes, I noticed that, thanks for the suggestion. Unfortunately, the result remains the same. How do I debug from here? Did anyone have success using DBD:mysql over SSL at all?
Re^2: DBI:mysql connection over SSL fails
by Anonymous Monk on Jan 15, 2016 at 20:27 UTC
    Fixed it for me. Thanks!
Re^2: DBI:mysql connection over SSL fails
by Anonymous Monk on Oct 02, 2014 at 21:02 UTC
    Thank you Ken, you saved my day!