Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: DBI Connection failed

by thanos1983 (Parson)
on Mar 25, 2019 at 10:15 UTC ( [id://1231651]=note: print w/replies, xml ) Need Help??


in reply to Re^2: DBI Connection failed
in thread DBI Connection failed

Hello again Anonymous Monk,

What fellow Monk Corion is raising is a very valid point. Have you checked if manually you can connect to the DB with the same credentials that you are using on your script? Sample from the official documentation (4.2.2 Connecting to the MySQL Server) see below:

mysql -h localhost -u myname -ppassword mydb

Can you check manually and let us know if the problem still exists with your username and password? Another possibility is that you are trying to pass special characters into your username / password and they are not processed correctly. For example characters as: @ or | and many others. If this is the case you can use the module quotemeta which will do the work for you.

For example:

#!/usr/bin/perl use strict; use warnings; use feature 'say'; my $mySpecialChar = q(@|); say $mySpecialChar; my $quotedSpecialChar = quotemeta $mySpecialChar; say $quotedSpecialChar; __END__ perl test.pl @| \@\|

Hope this helps, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1231651]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-03-29 14:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found