osx Lion mysql sock path

I just installed Lion and for some reasons my internal website stopped working due to the mysql lock file not being found. I found out that the new osx installation changed the mysql sock file default path from /var/mysql/mysql.sock to /tmp/mysql.sock.

So, to re-enable everything, do:

  1. shut down your Web Sharing
  2. cp /etc/php.ini.default /etc/php.ini (for some reasons my old php.ini got renamed to php.ini.default php.ini-5.2-previous…)
  3. modify /etc/php.ini, change ALL /var/mysql/mysql.sock to /tmp/mysql.sock
  4. enable Web Sharing

That will do it.

23 thoughts on “osx Lion mysql sock path

  1. Doesn’t work for me although I think it’s correct as I still can connect to MySQL server from command-line and there is “mysql.sock” file in /private/tmp/ directory.

    I has changed /priavte/etc/php.ini file but php_info() still shows mysql.default_socket = /var/mysql/mysql.sock. Have no idea why 😦


  2. Thank you very much! 😀
    It’s important to change the file name to php.ini for it to be recongized.
    Also that I changed at least 4 paths in the php.ini

    Very neat explanation.
    Thanks again.


  3. Thanks for this, had just installed a clean version of Lion and was migrating stuff manually from Snow Leopard. This was what I was missing 🙂


  4. Jon says:

    Thank you, quick easy fix. Seems like someone at apple could figure this out, when I installed mysql the first time it was a nightmare.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s