Fixing mysql in OS X Lion upgrade
After upgrading to OS X Lion today, MySQL seemed to stop working. In fact, mysql was still running, however there were 2 problems:
- php not connecting to mysql server
- 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:
- shut down your Web Sharing
- cp /etc/php.ini.default /etc/php.ini (for some reasons my old php.ini got renamed to php.ini.default…)
- modify /etc/php.ini, change /var/mysql/mysql.sock to /tmp/mysql.sock
- 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.