Mac is basically unix, use `netstat -an` ________________________________________ From: activeperl-boun...@listserv.activestate.com [activeperl-boun...@listserv.activestate.com] On Behalf Of Eric Robertson [eric...@blueyonder.co.uk] Sent: Monday, September 27, 2010 3:44 PM To: 'Bill Luebkert' Cc: activeperl@listserv.ActiveState.com Subject: RE: Problem Connecting to MySQL Database
> -----Original Message----- > From: Bill Luebkert [mailto:dbec...@roadrunner.com] > Sent: 27 September 2010 21:54 > To: Eric Robertson > Subject: Re: Problem Connecting to MySQL Database > > 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. > > That sounds like the SQL server isn't listening on 3306. Do you have > a utility program on OSX that can list the programs listening on a > port (like netstat on Windoze) and see if 3306 has a listener attached ? > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 9.0.856 / Virus Database: 271.1.1/3160 - Release Date: 09/26/10 > 08:01:00 Many thanks for this comment. I'm afraid I don't know how to do this on the Mac but will try to find out. Eric. _______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs