I recently updated the web application hosting environment on my Mac (Leopard, 10.5.6 as of this writing) in order to support a local copy of Drupal. I have a local copy of TWiki, which is the wiki software we use the most at work, but as I begin using Drupal more and more, I decided to start using it for my personal writing as well.
In order to support I Drupal I had to install MySQL and update PHP. Mac OS X does ship with PHP already installed, but it hasn’t been updated in quite a while. Apache is also shipped with OS X, and didn’t require updating at this time.
To start off, I installed the latest version of MySQL, which in the end turned out to be a mistake.
After installing phpMyAdmin, I received the following error:
Your PHP MySQL library version 5.0.45 differs from your MySQL server version 5.1.32. This may cause unpredictable behavior.
I then updated PHP per these instructions.
After the update, I still had the error, but the library version was now 5.0.77. Newer, but still not the same version as MySQL server.
At this point I could have (probably, it’s not trivial) installed PHP by compiling from source, but I had another idea in mind.
To make a long story short, I uninstalled MySQL and then downloaded and installed version 5.0.77.
After restarting Apache, the version mismatch warning noted by phpMyAdmin was gone!
There was one other trick required to get MySQL and phpMyAdmin to work. After the initial installation of both programs, I received the following error (even before the library/server version mismatch error):
The server is not responding (or the local MySQL server’s socket is not correctly configured)
Doing the following in a terminal window fixed things right up:
sudo mkdir /var/mysql sudo ln -s /private/tmp/mysql.sock /var/mysql/mysql.sock
Thanks to Mike Brenner in the MySQL forums for that tip.
Other things I discovered along the way:
Typically, MySQL is started when the system reboots. When testing it’s often necessary to stop and restart as needed; the following commands make this easy to do:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
These can be aliased nicely:alias start_mysql="/Library/StartupItems/MySQLCOM/MySQLCOM start" alias stop_mysql="/Library/StartupItems/MySQLCOM/MySQLCOM stop"
Thanks to Simplistic Complexity for that one.