I am on RHEL 5.5 64 bit
machine.
I installed ActivePerl 5.10 64 bit on the machine, upgrading the previous inbuilt Perl 5.8 64 bit. I have MySQL up and running and my PHP project is able to access it. My Perl file needs to access the same database using DBD, but it's not able to do that. I have verified that:
- My MySQL service is up and running.
- My user is present and the database along with data do exist.
- I am able to access the data from the database via the shell MySQL client.
Following is my Perl script.
#!/usr/bin/perl
use DBI;
$dbh = DBI->connect( "DBI:mysql:go:super218:3306","root","NEWPASSWORD" ) or die "Couldn't connect to database: " . DBI->errstr;
my $sth = $dbh->prepare( "SELECT * FROM phones" )
or die "Can't prepare SQL statement: $DBI::errstr\n";
$sth->execute or die "executing: $stmtA ", $dbh->errstr;
my @row;
while ( @row = $sth->fetchrow_array( ) ) {
print "Row: @row\n";
}
I am getting the following error with correct user and password :
DBI connect('go:super218:3306','root',...) failed: (no error string) at testdb.pl line 6
Couldn't connect to database: at testdb.pl line 6.
I get the following error with incorrect user or password:
DBI connect('go:super218:3306','root1',...) failed: Access denied for user 'root1'@'localhost' (using password: YES) at testdb.pl line 6
Couldn't connect to database: Access denied for user 'root1'@'localhost' (using password: YES) at testdb.pl line 6.
How do I solve this? I guess the problem is at MySQL's end.