Home > Computing, OS X > Fixing mysql in OS X Lion upgrade

Fixing mysql in OS X Lion upgrade

July 20th, 2011

After upgrading to OS X Lion today, MySQL seemed to stop working. In fact, mysql was still running, however there were 2 problems:

  1. php not connecting to mysql server
  2. mysql no longer in path (terminal commands “mysql -u root -p” doesn’t work)

I found the solution for (1) at: http://birdchan.com/home/2011/07/20/osx-lion-mysql-sock-path/
Here is what it says:

  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…)
  3. modify /etc/php.ini, change /var/mysql/mysql.sock to /tmp/mysql.sock
  4. enable Web Sharing

Or it looks like the file that you want to reinstate is “php.ini-5.2-previous” (had all of my old settings). If you follow the 4 steps above, you will also need to set the timezone in line 998 on you newly created php.ini: “date.timezone = Europe/London”.

To add the mysql into your path just create a file called mysql in /etc/paths.d :
sudo touch /etc/paths.d/mysql
Then add “/usr/local/mysql/bin” to the file using a text editor e.g.
sudo vi /etc/paths.d/mysql

Then I had to reboot.

Computing, OS X

  1. | #1

    Thanks for posting this. I was concerned about upgrading to Lion and after some search on the web this seemed to be the only thing I would need to do to get back up and running with native php on Lion and my previous install of mysql server (community) on Snow Leopard. I just made a copy of my /private/etc/php.ini prior to the Lion upgrade and copied back to /private/etc/php.ini after the Lion upgrade and software updates (Java). I did still need to make one change to /tmp/mysql.sock in my php.ini file for mysqli than phpmyadmin worked fine on localhost.

  2. | #2

    Worked like a charm. Thank you very much!

  3. | #3

    Thanks for these tips! Saved me hours of frustration! :-)

  1. | #1