Women in Technology

Hear us Roar

  Apache Web-Serving With Mac OS X, Part 5
Subject:   mysql socket problem solved.. OSX10.4
Date:   2006-06-23 04:59:13
From:   carlco2
Response to: mysql socket problem

After updating to Mac OS X 10.4.4, you may find that the connection between PHP and MySQL running on your local webserver is broken.

Apparently the socket file got moved in the update. You can make it start working again by entering the following commands in a Terminal window:

$ sudo mkdir /var/mysql
$ sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock


Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • ignore last entry!
    2006-06-23 05:35:31  carlco2 [View]

    The reason you must not use /tmp/mysql.sock is that any Tom, Dick or Other can simply delete it and bring your php-mysql system down.

    The fix is actually simple:
    sudo mkdir -p /var/mysql
    sudo chgrp mysql /var/mysql
    sudo chmog g+w /var/mysql

    edit/create /private/etc/my.cnf and add the line:

    restart mysql

    now the new php wil find the socket info in the right place, if you change php then you might need to tell that about the new secure location.
    • ignore last entry!
      2007-01-23 19:42:33  bobga [View]

      in the my.cnf (mine is in /etc/my.cnf) file you need two sections to contain the socket directive



      Without both of them you are pointing to different sockets (with the server (mysql) mysqld and the client (client) mysql and mysqladmin apps)

      It may be better just to copy one of the sample cnf files from /usr/local/mysql/support-files. Copy one of the samples (i used my-small.cnf as it's just for my home web server) to /etc/my.cnf and edit as needed (i.e. change /tmp/mysql.sock to /var/mysql/mysql.sock)

      Good luck,