MySQL on OS X Reinstall Reminders

First off, if you can avoid reinstalling MySQL on OS X – by all means do. Whatever the reason is that you want to do a reinstall, it’s not a good one1. Just buck up and work around whatever issue you have. It’s not as bad as what follows.

Let’s say you decide to reinstall anyway.

Since there’s no easy way to uninstall, you go on a crazy rabbit hunt – including showing all the hidden files2 – through your system to eradicate all instances of MySQL and any dbs (bu-bye data). Then, you downloaded and installed a fresh binary from dev.mysql.com. Now, there’s no reason to do 3 or 4 system restarts, but you haven’t listened to me this far.

Weeee.

Now, I’m pretty sure that if you go back into your Rails app and run rake db:migrate you’ll get the following:
dyld: Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib

Thank Peter Morris for reminding you to run:
sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle

Hey, not so fast, make sure you set up the same root pass you had before:
/usr/local/mysql/bin/mysqladmin -u root password new_password_here

1. My reason – I was intermittently getting "Lost connection to MySQL server during query" when running rake test. It seems better now. There had to be
2. defaults write com.apple.finder AppleShowAllFiles ON

3 comments

  1. This effort is complicated by the choice of MySQL distribution. There are several for something as popular as MySQL, and if you accidentally install from multiple package distributions, there will be trouble.

  2. Norm, the problem was that macports was conflicting w/ the MySQL ‘official’ binary. Since MySQL was the only thing macports was doing, and MySQL offers a nice System Preferences control panel, I decided to drop macports.

    Well – looks like I was using it for SVN too. 😉
    I grabbed the official binary of that as well. Seems simpler.

Comments are closed.