Re: Fwd: Need support for Perl::DBD::mysql

Theodore Katseres <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <CAJba5eraKLYRLR0-3qp8UfmD7gowCKWE-V02bnmqrHVDbkJ2Gg@mail.gmail.com>
On Dec 22, 2015 8:35 PM, "Donna Cote" <[email protected]> wrote:
>
> Thanks, John, for your time.
>
> Here is the successful connect on the command line:
>>
>> $ /usr/bin/mysql -u ldmdbuser2 -pb7cb452be401724b9a1b ldmsurvey
>>
>> Reading table information for completion of table and column names
>>
>> You can turn off this feature to get a quicker startup with -A
>>
>>
>> Welcome to the MySQL monitor.  Commands end with ; or \g.
>>
>> Your MySQL connection id is 5698
>>
>> Server version: 5.1.73 Source distribution
>>
>>
>> Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights
reserved.
>>
>>
>> Oracle is a registered trademark of Oracle Corporation and/or its
>>
>> affiliates. Other names may be trademarks of their respective
>>
>> owners.
>>
>>
>> Type 'help;' or '\h' for help. Type '\c' to clear the current input
statement.
>>
>>
>> mysql>
>
>
> My perl script reads a .config file which contains:
>>
>> $ ​
>> cat /opt/ldmsurvey/scripts/.config
>>
>> ldmsurvey,ldmdbuser2,b7cb452be401724b9a1b
>>
>>
>
>
> ​The script's output is:
>>
>> $ ./gather-details-n-do-db-inserts.pl ldm1-log-sample.log
>>
>>  debug 51 pre gather db config routine
>>
>>   debug 58: post gather-db-config-routine, database=ldmsurvey,
userid=ldmdbuser2
>>
>>  debug 65 pre attempt db connection with dbi:mysql:ldmsurvey  ldmdbuser2
 b7cb452be401724b9a1b
>>
>>
>>
>> DBI connect('ldmsurvey','ldmdbuser2',...) failed: Access denied for user
'ldmdbuser2'@'localhost' (using password: YES) at ./
gather-details-n-do-db-inserts.pl line 65
>>
>> Access denied for user 'ldmdbuser2'@'localhost' (using password: YES) at
./gather-details-n-do-db-inserts.pl line 65.
>>
>> $
>
>
> ​Just don't understand. ​

Make sure $password does not contain your EOL  ($/)

Try ...

chomp $password ;

before DBI->connect

-- Ted

> On Tue, Dec 22, 2015 at 7:49 PM, John R Pierce <[email protected]>
wrote:
>>
>> On 12/22/2015 5:36 PM, Donna Cote wrote:
>>>
>>> I have perl-DBD-MySQL-4.013-release-3.el6 and Perl 5.10.1 and while I
have a user account which can connect to the database at the command
prompt, I cannot get the same user (or any user) to connect from within my
Perl script. Actually, I succeeded with one connection one time (from
within Perl script) on 20-Dec-2015 (Sun Dec 20 22:35:53 CST 2015).
>>
>>
>>
>> I see your perl program has a bunch of debug print's, but you don't show
the actual output from them, nor the contents of your .config file which
apparently contains the database connection parameters.
>>
>> it would also be useful to see the command line you use to successfully
connect to this database at the command prompt.
>>
>>
>>
>> --
>> john r pierce, recycling bits in santa cruz
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.