Acces denied via localhost!
Hi everyone,
my problem is as follows, I have a MySQL database on a MacBook Pro with SnowLeopard and I use the MAMP interface to work with it. I have a perl script which send request on this database. The problem is that my script can only connect to the database if I set the server address with the one I have with the Lan network at my job, but won't if I use the localhost! what's crazy is that the database is locally on my Mac! And I've tested to connect with another Mac on the lan work and it works too! The problem is really that I can't connect to my own local database with "localhost" as server address.
little perl script :-
---------------------------------
#!/usr/bin/perl
use strict;
use Getopt::Long;
use DBI;
my $host = "localhost:8889";
my $user = "root";
my $mdp = "root";
my $base = "testPierre";
my $table = "tbPVC";
my %genes;
my $dbh;
$dbh = DBI->connect("DBI:mysql:$base:$host",$user, $mdp) or die "Echec de la conexion",$!,"\n";
my $sel = $dbh->prepare("SELECT * FROM `tbPVC62` WHERE `species_in_cluster` LIKE 'Chlamydia_muridarum.fa-Chlamydia_trachoR.fa'");
$sel->execute || die "Pb de selection : $DBI::errstr";
while (my ($champ1, $champ2, $champ3, $champ4, $champ5, $champ6, $champ7, $champ8) = $sel -> fetchrow_array)
{
print ("Contenu : $champ1, $champ2, $champ3, $champ4, $champ5, $champ6, $champ7, $champ8 \n");
}
$sel->finish;
---------------------------------
Shell msg :-
DBI connect('testPierre:localhost:8889','root',...) failed: Access denied for user 'root'@'localhost' (using password: YES) at ./db.pl line 25
Echec de la conexion
-----------------------------------
Privileges on MAMP
Utilisateur Serveur Mot de passe Privilèges globaux 1 "Grant"
root localhost Oui ALL PRIVILEGES Oui