Part of making OS X 10.6 (Snow Leopard) a great LAMP development platform is installing MySQL. Here’s how to install that along with the most popular web interface for managing MySQL, PHPMyAdmin.
1. Download the Mac OS X 10.5 (x86_64) package format from dev.mysql.com. The downloaded file should be named mysql-5.1.xx-osx10.5-x86_64.dmg with “xx” replaced with a minor release number. Open it and see something like this:
2. Double click the mysql-5.1.xx-osx10.5-x86_64.pkg and install it with the defaults.
3. Do the same for MySQLStartupItem.pkg.
4. Double click MySQL.prefPane and follow the instructions to add the MySQL pane to your System Preferences.
5. Open System Preferences -> MySQL and start MySQL. Check “Automatically Start MySQL Server on Startup” unless you want to restart it with this panel manually every time you reboot.
We’re done with MySQL. Now lets download and install PHPMyAdmin.
6. Download the PHPMyAdmin .bz2 file from phpmyadmin.net. Put it in the Sites folder (under your home folder). Double click it in Finder to unarchive it. Rename the folder it creates to phpMyAdmin (just removing the version info to make it easier to remember). Now for the trickiest part. Edit the Apache configuration files.
7. Edit system file /etc/apache2/httpd.conf and just remove the # from the line that includes the httpd.vhosts file. From now on whenever I say “edit system file” that means use sudo and your favorite editor. (I use vi but I would never recommend that unless you want to learn a powerful but very obscure and difficult to learn editor.) If you’re not sure how to edit a system file try this. Open Terminal (Applications -> Utilities -> Terminal) and enter this command to edit system file /etc/apache2/httpd.conf:
sudo nano /etc/apache2/httpd.conf
When it asks for a password, enter your OS X login password. Look at the hints at bottom of the Terminal figure out how to write the file with your changes and exit the editor.
Should look like this when you’re done:
8. Edit system file /etc/apache2/extra/httpd-vhosts.conf and replace the VirtualHost example blocks with this (replacing roger with your own username):
CustomLog “/private/var/log/apache2/phpMyAdmin.localhost-access_log” common
Allow from All
9. Edit system file /etc/hosts to add the local domain name for your PHPMyAdmin site. Just add this line to the file:
10. Now just restart the web server with the new configuration with this command:
sudo /usr/sbin/apachectl restart
11. Open your browser and visit http://phpMyAdmin.localhost to experience the victory and start managing your databases.
I think these instructions should work just as well on 10.5 (Leopard).
Good luck and post a comment if you need any help.