IdolHands.com :: Days in the Life of an Alpha Geek
If you're following the instructions on the Ruby on Rails blog for upgrading to Snow Leopard, you should notice that one of the recommended steps is installing the 64-bit version of MySQL. What the article fails to mention is that there are a couple of clean-up steps that you should do, and that you will also need to restore your old data directory or risk losing your development databases.
The tips below assume that you've already downloaded and installed MySQL for OS X 10.5, 64-bit.
If you installed MySQL using MacPorts, type this in Terminal to stop the MySQL daemon:
sudo /opt/local/share/mysql5/mysql/mysql.server stop
Otherwise, if you used the installer from mysql.com, go to Apple Menu > System Preferences and click on the MySQL preference pane. You'll get a message stating that System Preferences has to restart; this is because the preference pane is a 32-bit app, and System Preferences is now a 64-bit app.

You're going to get tired of restarting System Preferences, so I recommend that you go download the replacement pref pane from swoon dot net. Go ahead, I'll wait.
When you're all set, make sure that MySQL is not running. For a sanity check, fire up Applications > Utilities > Activity Monitor and search for 'sql':

If you shut down MySQL correctly, you should not see the mysqld process running.
Terminal is your friend:
The new version of MySQL is aliased to /usr/local/mysql, and the old version is still there: in this case, in mysql-5.0.77-osx10.5-x86 (your version number may vary, but just look for the folder with the largest version number that ends with x86). Your data directory with all of your development databases is safely tucked away inside.
cd into the folder you located in the step above and then do the following:
sudo cp -R data ../mysql/data_prev
Now cd to the directory where the new version lives, move the (empty) data directory aside, and replace it with your previous version:
cd ../mysql
sudo mv data data_aside
sudo mv data_prev data
You'll also need to change the owner on the newly moved data directory:
sudo chown -R _mysql:wheel data
Warning: The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' user.'
...then you didn't correctly change the owner in the previous step.
Once you are sure that you've recovered your old data (hint: try script/console inside one of your Rails apps and see if your database exists), you can safely remove the old MySQL installation:
sudo rm -rf mysql-5.0.*
Everything should now be right with the world. Go write some code and enjoy the new 64-bit goodness of Ruby, Rails, and MySQL on Snow Leopard.
![]()
Andy Baker
September 2, 2009 at 10:28 PMI had a similar experience but couldn't work out the correct chown incantation. In the end I used cp with the -p switch and it correctly preserved the existing permissions.