Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: DBI Connection failed

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


in reply to DBI Connection failed

Hello Anonymous Monk,

I assume since this similar post (Access denied for user 'koha_library'@'localhost' (using password: YES)) was made yesterday it was made by you. At this post you are providing the OS that you are running but not the Perl Version or the DBI version that you are running. Since I can see from the post that you are running a 14.04 LinuxOS I assume you are running an old version of Perl and DBI.

The easiest and fastest possible solution to your problem is to update Perl to the latest possible version of your OS (which will result also updating the DBI). As soon as you do that and your code still does not work (produce the same error), create a minimal reproductive example and post here so we can experiment with your code. Remember to let us know the Perl and DBI version of your minimal example code (after updating Perl).

Hope this helps, BR.

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

Replies are listed 'Best First'.
Re^2: DBI Connection failed
by Corion (Patriarch) on Mar 25, 2019 at 09:06 UTC

    In addition to this general debugging advice, I would first check whether the error message really does not apply.

    If MySQL claims that the user koha_library is using an invalid password for the connection, then maybe the password is the wrong MySQL password for this user?

    This is something only the OP can check (and double-check).

      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://1231647]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found