Installing MySQL on Mac OS X for use with PHP

Discussion in 'OT Technology' started by ez4me2c3d, Nov 15, 2006.

  1. ez4me2c3d

    ez4me2c3d Cold Member

    Joined:
    Sep 19, 2003
    Messages:
    1,836
    Likes Received:
    0
    Location:
    Minneapolis, MN
    How to do eet?

    Frigg'n aye man. I tried the binary install, and it seemed like it worked. But when I try a simple connection in PHP, I get an ugly error message of:
    Code:
    Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2) in /Library/WebServer/Documents/index.php on line 19
    Could not connect: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
    Research showed it was a lack of a socket file. Researched it up, found nothing that helped. Do I create it? Is it already created? Who knows? You'd think a binary install file would take care of this!!

    Then I found this: http://developer.apple.com/internet/opensource/osdb.html
    but I wasn't able to follow the "Quick install Instructions" for some of the commands are not available under Mac OS X. You'd think the apple guy that published that document would have known that!!

    So. Whose done it? And how do I fix my messy installs so that I can get back on track?
     
  2. mobbarley

    mobbarley Active Member

    Joined:
    Mar 4, 2005
    Messages:
    9,256
    Likes Received:
    2
    Location:
    Sydney
    did you use the version of php which comes with os-x? i use entropy's package and it works fine....
     
  3. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    looks like MySQL isn't even running and this can be from a few different issues.

    1.) Make sure you actually tried to start the service.
    2.) If you started it, check the MySQL log for errors on startup
    3.) A common problem is that the mysql user doesn't have access to the /var/mysql folder. You need to give that user (or whatever user you are running mysql with) ownership of that folder, with write permissions.
     
  4. TheManLouisianaFace

    TheManLouisianaFace and decide!

    Joined:
    Sep 22, 2004
    Messages:
    32,995
    Likes Received:
    0
  5. CarRamRod

    CarRamRod The schnozzberries taste like schnozzberries.

    Joined:
    Jan 16, 2006
    Messages:
    902
    Likes Received:
    0
    Location:
    Austin, TX
  6. agent0068

    agent0068 OT Supporter

    Joined:
    Jun 28, 2002
    Messages:
    39,833
    Likes Received:
    0
    this issue rings a bell and i *think* it is a known issue with the pre-installed mySQL binary on OS X. i wish i could remember the solution though...try logging into mySQL via the Terminal and it will (probably) give you an error message. Google for a chunk of that message in quotes and I believe you will find a knowledge-base sort of article on mySQL's site...I think it might have been something as simple as copying something into your /Library/StartupItems, but I really don't recall the specifics
     
  7. datboiwilly

    datboiwilly OT Supporter

    Joined:
    Sep 18, 2002
    Messages:
    2,936
    Likes Received:
    0
    Location:
    Houston
    MAMP works great. I had trouble with installing PHP/MySQL/Apache on Windows and found XAMPP. Got my Macbook and found MAMP by accident. The widget is convenient also
     
  8. ez4me2c3d

    ez4me2c3d Cold Member

    Joined:
    Sep 19, 2003
    Messages:
    1,836
    Likes Received:
    0
    Location:
    Minneapolis, MN

Share This Page