MySQL Forums
Forum List  »  Perl

Acces denied via localhost!
Posted by: kirsley chennen
Date: February 19, 2010 05:04AM

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 :-
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");

Shell msg :-

DBI connect('testPierre:localhost:8889','root',...) failed: Access denied for user 'root'@'localhost' (using password: YES) at ./ 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

Options: ReplyQuote

Written By
Acces denied via localhost!
February 19, 2010 05:04AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.