Hello guys,

Long time reader but this is my first question.

I have a MySQL server in a data center and processing servers in another place, therefore I need to encrypt connections from my Perl scripts to the database. All the necessary settings were made on MySQL (creation of a new user, creation of ca, server and client keys) and MySQL connections over SSL work fine.

root@server:# mysql -h _HOST_ --port 3306 -u _SSL_USER_ --ssl-cert=/et +c/mysql/certs/client-cert.pem --ssl-key=/etc/mysql/certs/client-key.p +em -p _DATABASE_ Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 49694205 Server version: 5.0.96 Source distribution ...

So, I believe set up is good. The problem is that I can't make my Perl script to connect to the database. The returned error is simply:

Access denied for user '_SSL_USER_'@'_HOST_' (using password: YES) at temp.pl line 7.

To simplify, I've put only the following code in my script:

#!/usr/bin/perl use strict; use DBI; #DBI->trace(5); my $dbh = DBI->connect( "DBI:mysql:database=_DATABASE_;host=_HOST_; mysql_ssl=1; mysql_ssl_client_key=/etc/mysql/certs/client-k +ey.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; exit(0);

The DBD::mysql module was compiled with the '-ssl' option.

I can't figure it out or find ways to further debug. Any help would be much appreciated.

Thank you!


In reply to DBI:mysql connection over SSL fails by Andre_C10002

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.