Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
EDIT: Solved-ish. Part of my problem appears to have been that I only added the bin area of the MySQL version to my path before calling cpanm to build DBD::mysql. Once I added the lib area of the mysql version as well and rebuilt 4.043 DBD::mysql I now have a working version. However, this seems super fragile. 4.050 DBD::mysql still doesn't work and DBD::MariaDB still doesn't work. This was all with the 5.26.1 version of Perl. I am going to give this a try on my original repo with 5.30.2 and see if it works. At least there is a little light at the end of this tunnel. I'd still love to figure out the right way to do all of this.

TLDR:
PROBLEM: Access denied for user 'USER_REPLACED'@'IP_REPLACED' (using password: YES) error 1045 recorded: Access denied for user 'USER_REPLACED'@'IP_REPLACED' (using password: YES)
WORKS: DBI 1.639-nothread w/ 5.26.1 perl w/ DBD::mysql 4.043 from standard install path in controlled linux environment connects to MariaDB 10.2 in internal dbaas cloud
NO DICE: DBI 1.643-nothread w/ 5.30.2 Perl w/ DBD::mysql 4.050 from perlbrew install path in controlled linux environment fails to connect to MariaDB 10.2 in internal dbaas cloud
NO DICE: DBI 1.616-nothread w/ 5.14.1 Perl w/ DBD::mysql 4.020 from standard install path in controlled linux environment also fails to connect to MariaDB 10.2 in internal dbaas cloud

Same script, same host, repeatable, but version dependent(maybe?) failures. So the question remains, how can I debug and fix this? I've many other posts on this error, but they are usually a config issue with the DB or a bad username/password. If this failed across the board I would think I was in the same boat, but the same code works on a specific perl install.

Full fat version:
I'm stumped. I work in a fairly restricted computing environment with pre-installed Perl and libraries. Several years ago now I picked up perlbrew as a way to allow me to develop tools that used CPAN libraries not preinstalled with the available Perl versions on our systems.

Getting DBD::MySQL was a pain, since it requires mysql_config availability, which is not part of the normal path in this environment. Thanks to some other help I was able to get it installed and was able to get my perlbrewed script to connect to a MySQL db I use internally. Yay! Not so much.

This new DB I am working on uses an internal dbaas mariaDB instance: MYSQL (MariaDB 10.2). With the stock version of Perl in our environment 5.14.1 I fail to connect, with a second standard install Perl version 5.26.1 I am able to connect, and finally, with my PerlBrewed 5.30.2 I am unable to connect.

In each case, I am using an identical script and just changing the Perl version that is installed to isolate variables in my testing.

#!/STANDARDINSTALLPATHTHATWORKS/5.26.1/bin/perl use strict; use warnings; use Data::Dumper; use DBI; my $database = "DB_REMOVED"; my $hostname = "HOST_REMOVED"; my $port = "PORT_REMOVED"; my $user = "USER_REMOVED"; my $pass = "PASS_REMOVED"; my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port"; DBI->trace(2); my $dbh = DBI->connect($dsn, $user, $pass) or die("Failed to connect t +o DB: $!");
I found DBI's trace function, but it hasn't told me anything new, but here are the outputs first from the failing one(perlbrew) and then from the passing one:
DBI 1.643-nothread default trace level set to 0x0/2 (pid 87123 pi +0) at dbtest line 20 -> DBI->connect(DBI:mysql:database=DB_REPLACED;host=HOSTNAME_REPLA +CED;port=PORT_REPLACED, USER_REPLACED, ****, HASH(0x9094f0)) -> DBI->install_driver(mysql) for linux perl=5.030002 pid=87123 ru +id=ID_REPLACED euid=ID_REPLACED install_driver: DBD::mysql version 4.050 loaded from PRIVATEPER +LBREWINSTALL/extlib/lib/perl5/x86_64-linux/DBD/mysql.pm <- install_driver= DBI::dr=HASH(0xc91698) !! The warn '0' was CLEARED by call to connect method -> connect for DBD::mysql::dr (DBI::dr=HASH(0xc91698)~0xce2e38 'da +tabase=DB_REPLACED;host=HOSTNAME_REPLACED;port=PORT_REPLACED' 'USER_R +EPLACED' **** HASH(0xb558d0)) imp_dbh->connect: dsn = database=DB_REPLACED;host=HOSTNAME_REPLACED;po +rt=PORT_REPLACED, uid = USER_REPLACED, pwd = PASSWORD_REPLACED imp_dbh->my_login : dbname = DB_REPLACED, uid = USER_REPLACED, pwd = P +ASSWORD_REPLACED,host = HOSTNAME_REPLACED, port = PORT_REPLACED imp_dbh->mysql_dr_connect: host = |HOSTNAME_REPLACED|, port = PORT_REP +LACED, uid = USER_REPLACED, pwd = PASSWORD_REPLACED imp_dbh->bind_type_guessing: 0 imp_dbh->use_server_side_prepare: 0 imp_dbh->disable_fallback_for_server_prepare: 0 imp_dbh->mysql_dr_connect: client_flags = 2 imp_dbh->mysql_dr_connect: <- --> do_error Access denied for user 'USER_REPLACED'@'IP_REPLACED' (using password: +YES) error 1045 recorded: Access denied for user 'USER_REPLACED'@'IP_ +REPLACED' (using password: YES) <-- do_error -> DESTROY for DBD::mysql::db (DBI::db=HASH(0xce33f0)~INNER) DESTROY for DBI::db=HASH(0xce33f0) ignored - handle not initi +alised ERROR: 1045 'Access denied for user 'USER_REPLACED'@'IP_REPLACE +D' (using password: YES)' (err#0) <- DESTROY= ( undef ) [1 items] at mysql.pm line 163 !! ERROR: 1045 'Access denied for user 'USER_REPLACED'@'IP_REPLACE +D' (using password: YES)' (err#0) <- connect= ( undef ) [1 items] at DBI.pm line 679 -> $DBI::errstr (&) FETCH from lasth=HASH <- $DBI::errstr= 'Access denied for user 'USER_REPLACED'@'IP_REPLA +CED' (using password: YES)' DBI connect('database=DB_REPLACED;host=HOSTNAME_REPLACED;port=P +ORT_REPLACED','USER_REPLACED',...) failed: Access denied for user 'US +ER_REPLACED'@'IP_REPLACED' (using password: YES) DBI connect('database=DB_REPLACED;host=HOSTNAME_REPLACED;port=PORT_REP +LACED','USER_REPLACED',...) failed: Access denied for user 'USER_REPL +ACED'@'IP_REPLACED' (using password: YES) at PRIVATEPERLBREWINSTALL/. +bin/dbtest line 21. -- DBI::END ($@: , $!: ) !! The ERROR '1045' was CLEARED by call to disconnect_all method -> disconnect_all for DBD::mysql::dr (DBI::dr=HASH(0xc91698)~0xce2 +e38) <- disconnect_all= ( ) [0 items] (not implemented) at DBI.pm line +758 ! -> DESTROY in DBD::_::common for DBD::mysql::dr (DBI::dr=HASH(0xce +2e38)~INNER) ! <- DESTROY= ( undef ) [1 items] during global destruction
Passing one:
DBI 1.639-nothread default trace level set to 0x0/2 (pid 87340 pi +0) at old_dbtest line 20 -> DBI->connect(DBI:mysql:database=DB_REPLACED;host=HOSTNAME_REPLA +CED;port=PORT_REPLACED, USER_REPLACED, ****) -> DBI->install_driver(mysql) for linux perl=5.026001 pid=87340 ru +id=ID_REPLACED euid=ID_REPLACED install_driver: DBD::mysql version 4.043 loaded from STANDARDEN +VINSTALLAREA/x86_64-linux/DBD/mysql.pm <- install_driver= DBI::dr=HASH(0x974b28) !! The warn '0' was CLEARED by call to connect method -> connect for DBD::mysql::dr (DBI::dr=HASH(0x974b28)~0x9ac9f8 'da +tabase=DB_REPLACED;host=HOSTNAME_REPLACED;port=PORT_REPLACED' 'USER_R +EPLACED' **** HASH(0x83f588)) imp_dbh->connect: dsn = database=DB_REPLACED;host=HOSTNAME_REPLACED;po +rt=PORT_REPLACED, uid = USER_REPLACED, pwd = PASSWORD_REPLACED imp_dbh->my_login : dbname = DB_REPLACED, uid = USER_REPLACED, pwd = P +ASSWORD_REPLACED,host = HOSTNAME_REPLACED, port = PORT_REPLACED imp_dbh->mysql_dr_connect: host = |HOSTNAME_REPLACED|, port = PORT_REP +LACED, uid = USER_REPLACED, pwd = PASSWORD_REPLACED imp_dbh->bind_type_guessing: 0 imp_dbh->use_server_side_prepare: 0 imp_dbh->disable_fallback_for_server_prepare: 0 imp_dbh->mysql_dr_connect: client_flags = 2 imp_dbh->mysql_dr_connect: <- <- connect= ( DBI::db=HASH(0x9acf80) +) [1 items] at DBI.pm line 676 -> STORE for DBD::mysql::db (DBI::db=HASH(0x9ad1a8)~INNER 'PrintEr +ror' 1) <- STORE= ( 1 ) [1 items] at DBI.pm line 728 -> STORE for DBD::mysql::db (DBI::db=HASH(0x9ad1a8)~INNER 'AutoCom +mit' 1) <- STORE= ( 1 ) [1 items] at DBI.pm line 728 -> STORE for DBD::mysql::db (DBI::db=HASH(0x9ad1a8)~INNER 'Usernam +e' 'USER_REPLACED') <- STORE= ( 1 ) [1 items] at DBI.pm line 731 -> STORE for DBD::mysql::db (DBI::db=HASH(0x9ad1a8)~INNER 'mysql_c +onn_attrs' HASH(0x9ad160)) $h->{'mysql_conn_attrs'}=HASH(0x9ad160) ignored for invalid driver-spe +cific attribute <- STORE= ( '' ) [1 items] at DBI.pm line 731 -> connected in DBD::_::db for DBD::mysql::db (DBI::db=HASH(0x9acf +80)~0x9ad1a8 'DBI:mysql:database=DB_REPLACED;host=HOSTNAME_REPLACED;p +ort=PORT_REPLACED' 'USER_REPLACED' ****) <- connected= ( undef ) [1 items] at DBI.pm line 738 <- connect= DBI::db=HASH(0x9acf80) -> STORE for DBD::mysql::db (DBI::db=HASH(0x9ad1a8)~INNER 'dbi_con +nect_closure' CODE(0x9ac890)) <- STORE= ( 1 ) [1 items] at DBI.pm line 747 Died at bin/old_dbtest line 24. -> DESTROY for DBD::mysql::db (DBI::db=HASH(0x9ad1a8)~INNER) imp_dbh->pmysql: 9c7aa0 <- DESTROY= ( undef ) [1 items] at old_dbtest line 24 -- DBI::END ($@: , $!: ) -> disconnect_all for DBD::mysql::dr (DBI::dr=HASH(0x974b28)~0x9ac +9f8) <- disconnect_all= ( ) [0 items] (not implemented) at DBI.pm line +755 ! -> DESTROY in DBD::_::common for DBD::mysql::dr (DBI::dr=HASH(0x9a +c9f8)~INNER) ! <- DESTROY= ( undef ) [1 items] during global destruction

In reply to [SOLVED-ISH]DBI Connection Fails with Access Denied on one version of Perl/DBD::MySQL and work on the other by varneraa

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-03-29 06:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found