> > On 9/26/2010 1:06 PM, Eric Robertson wrote:
> > 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.
>
> -----Original Message-----
> From: Czarnowas, Andrew [mailto:andrew.czarno...@thebeerstore.ca]
> Sent: 28 September 2010 14:45
> To: Eric Robertson
> Subject: RE: Problem Connecting to MySQL Database
> 
> MAMP & MAMP PRO uses Default port 8889 for mysql. You can also find the
> ports in MAMP application's Preferences Panel
> 
> Here are some FAQs for MAMP & MAMP PRO
> http://www.mamp.info/en/documentation/faq.html#q6
> 
> Andrew
>

Many thanks Andrew - I should have tried looking at the MAMP FAQs! I did as
you suggest and changing the server's listening port to 3306 has solved the
problem.

I can now get with debugging my code using the MySQL database on my local
server.

Eric


_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to