Problem Connecting to MySQL Database

"Eric Robertson" <[email protected]>
Newsgroups gmane.comp.lang.perl.active-perl
Message-ID <F36D2EBCF63A4AC1909D032FEF068078@macbookXP>
I'm using a MacBook Pro running OS X 10.6.4 and I installed ActiveState Perl
- I'm using version 5.8.8 at the moment. I did this to make it easier to
install some of the modules I wanted but I'm not sure I wouldn't have been
better just to use the Perl that comes with the Mac OS!

 

The problem I have is that I can't connect to a MySQL database that I have
on the MacBook, set up using MAMP PRO. When I was running everything under
Windows I used to have the DBD::mysql driver installed but this doesn't seem
to be available for this build so I'm using DBD::mysqlPP which I assume
should work in the same way. However the connection string fails when I try
to connect using the following:

 

$dsn = "DBI:mysqlPP:host=localhost:database=$database";

$dbh = DBI->connect($dsn, $username, $database, {

   RaiseError => 0,

   PrintError => 0

}) || ($error = "Got error '$DBI::errstr' when connecting to $dsn\n");

 

and the error message is:

 

Got error 'Couldn't connect to localhost:3306/tcp: IO::Socket::INET:
connect: Connection refused at
/Users/(myname)/Library/ActivePerl/lib/DBD/mysqlPP.pm line 109' when
connecting to
DBI:mysqlPP:host=localhost:database=$database.

 

I've checked that I was using the correct username and password, setting up
and trying different ones, but without success. I have a feeling that I read
somewhere that there was a problem using Perl to connect to a database set
up under MAMP but can't recall what the problem was.

 

Can anyone suggest why this is not working.

 

Eric Robertson

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
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.