MySQL Forums
Forum List  »  Install & Repo

Problem with MySQL Installation On Mac
Posted by: Steve Wilkison
Date: September 06, 2010 10:07AM

I'm using Mac OS 10.6.4. I have installed MySQL. I can access it via the Terminal and do all the normal things, create databases, create tables, etc. It all works just as I would expect it to.

But, when I try to connect via a web script it won't connect.

I created a very simple little php script to test the connection:


echo mysql_connect ('localhost', 'root', 'mypassword');


When I load this page I get the following error:

Warning: mysql_connect() [function.mysql-connect]: [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /Users/stevewilkison/Sites/connect.php on line 3

Warning: mysql_connect() [function.mysql-connect]: No such file or directory in /Users/stevewilkison/Sites/connect.php on line 3

I don't understand why I am able to access the MySQL via the Terminal but not via a php script. I'm using the same user (root) and password in the Terminal that I'm using in the php script. I've done this before and never had any problems.

Any help would be greatly appreciated, as this is driving me crazy!

Thanks very much.

Options: ReplyQuote

Written By
Problem with MySQL Installation On Mac
September 06, 2010 10:07AM

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.