Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Problem with PHP connecting to MySQL

Problem with PHP connecting to MySQL
Thread Tools
DemersDesigns
Fresh-Faced Recruit
Join Date: Jun 2006
Location: Boston::MA::USA::Earth
Status: Offline
Reply With Quote
Apr 1, 2006, 08:16 AM
 
Hey

I am having issues with PHP and MySQL on my Mac OS/X client machine, I have MySQL 5.0 GA installed the Apache 1.3 and PHP4 installed (and enabled) that came with Mac OS/X Tiger.

MySQL works fine when I connect using something like Navicat, and PHP works fine until I try and connect to a database when I then get an error "Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)".

I created a my.cnf in /usr/local/mysql/data by copying it from the mysql/support-files/my-small.cnf and sure enough the socket is pointed at /tmp/mysql.sock. I have tried editing that to /var/mysql/mysql.sock but mysql wouldnt start then Not good...

Does anyone know how I can make apache/php look for /tmp/mysql.sock instead of /var/mysql/mysql.sock?

Thanks
Dave
     
Rainy Day
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
Reply With Quote
May 1, 2006, 02:55 AM
 
In Terminal.app try: sudo ln -s /private/tmp/ /private/var/mysql
     
DemersDesigns  (op)
Fresh-Faced Recruit
Join Date: Jun 2006
Location: Boston::MA::USA::Earth
Status: Offline
Reply With Quote
May 1, 2006, 03:15 AM
 
Thanks for the reply, I managed to solve it with the same command.

I blogged it here if thats useful to anyone:
http://macnewbie.wordpress.com/2006/...socket-gotcha/
and more details on this solution:
http://macnewbie.wordpress.com/2006/...tiger-the-fix/
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 05:43 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,