Tuesday, October 30, 2007

Installing MySQL 5 on Mac OS X 10.5 Leopard

Installing MySQL 5.0 was fairly simply on Mac OS X Leopard, with a view caveats:

1. For some reason, MySQL didn't start properly until I rebooted the machine. After installation, I could start and stop the mysql server from the command line (Terminal) but not from the preferences pane. After a restart it all works normally.

2. PHP in Leopard looks for the mysql socket in a different place. So I created a symlink to point back to MySQL 5's default location. Hopefully this allows for both old and new systems to work together regardless of where they expect the socket to be:


sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
sudo chown _mysql /var/mysql/mysql.sock
sudo chmod 777 /var/mysql/mysql.sock


Now the PHP is talking to MySQL.

Don't forget to enable PHP in the web server. To do this, edit the file /etc/apache2/httpd.conf and remove the comments on this line:

LoadModule php5_module libexec/apache2/libphp5.so

No comments: