This post is more for me than for the typical reader of this blog. So, if you’re not a developer, you might want to skip this post.
Wanted to jot down some quick lessons learned, in case I ever encounter these problems again. Yesterday, in the rails project for imaiku, we migrated from sqlite to mysql2. Here are some of the issues, I experienced, they’re probably newbie issues. But it caused a great headache for myself.
1. mysql2 would not install because it could not find libs — Fix install MySQL community server at http://dev.mysql.com/downloads/
2. after install could not run rake because it could not locate libmysqlclient — had to run sudo install_name_tool -change…for it to run. A lot of google and stackoverflow searches, but this sums it up here. http://stackoverflow.com/questions/4546698/library-not-loaded-libmysqlclient-16-dylib-error-when-trying-to-run-rails-serve
>> sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /Users/DiyahM/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
3. Somehow during the night, I couldnt access mysql through the command line, and had to reset my password, without knowing my original password. Had to start restart the sql server using the mysqld –skip-grant-tables options. http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
4. Finally able to access mysql and had to add mysql permissions for the projects database.
Rough night and draining morning. But its fixed, and here are my notes in case I come across this headache again.
Update: I noticed that I was able to solve this problem quicker in about 30mins this morning, as opposed to working on this til 3am. So, note to self, when tired, just go to sleep.
8/22/11 Update: After doing a gem update, had to repeat these steps. Changed gem file to use mysql2 0.2.11 instead of mysql2 0.2.13. After the change to mysql2 0.2.11, no longer was getting the dlopen error.