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.
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
defaults write com.apple.finder AppleShowAllFiles ON