Matt Langtree

MySQL Lion Not Working

If you are like me you used the default MySQL, Apache and PHP provided with Mac OS X Snow Leopard. When you upgraded to Lion it most likely broke for you.

These are the steps that I followed to get MySQL working on Lion:

  1. Update php.ini - enable all mysql extensions (because I use Zend, wordpress and other frameworks)
  2. Make sure MySQL is started and you can connect to it in Sequel Pro
  3. Go to Database > Server Variables and search for ‘socket’. It will most likely be set to ‘/tmp/mysql.sock’
  4. Update the socket locations for MySQL in your php.ini to /tmp/mysql.sock

Before:

1
2
`pdo_mysql.default_socket=/var/mysql/mysql.sock mysql.default_socket =
/var/mysql/mysql.sock mysqli.default_socket = /var/mysql/mysql.sock`

After:

1
2
`pdo_mysql.default_socket=/tmp/mysql.sock mysql.default_socket =
/tmp/mysql.sock mysqli.default_socket = /tmp/mysql.sock`

Go to System Preferences > Sharing and restart ‘Web Sharing’ by unticking then ticking the checkbox next to it.

Refresh the local website you were working on it should all be working. Fingers Crossed.