MySQL Forums
Forum List  »  Perl

Problem Connecting to Server with Perl
Posted by: Eric Robertson
Date: September 05, 2010 02:54AM

I had been able to connect to the MySQL server when I was working in Windows but I now have a Mac and have installed MAMP so I can easily set up the MySQL databases that I want. However I get the following error message when I try to connect:

"Couldn't connect to localhost:3306/tcp: IO::Socket::INET: connect: Connection refused at ......./ActivePerl/lib/DBD/ line 109 when connecting to DBI:mysqlPP:host=localhost:database=......"

I was using:

my $dsn = "DBI:mysqlPP:host=localhost:database=$database";
my $dbh = DBI->connect($dsn, $username, $password);

I saw an earlier posting here where someone was having what appeared to be the same problem. It was said there that if the bind-address is localhost, mySql automatically open a named pipe. It referred to the my.ini file under the mysqld section where there should be two line like the following:


I can't locate this file - I suppose it's buried somewhere in MAMP. The solution suggested was to use the ip address instead so I therefore tried changing 'localhost' to '' but I got the same error.

Can someone explain what is going wrong please?

Options: ReplyQuote

Written By
Problem Connecting to Server with Perl
September 05, 2010 02:54AM

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.