How to fix MySQL load issues on OS X

This is only for those who encounter the same issues. Sometimes we’re not so lucky with mysql and I worked with an Australian developer who said he never got mysql installation right the first time regardless of whether he was using a Mac or Windows. I never had the same problems before until now. I am using OS X 10.6.6 and MySQL 5.5. I now feel his pain. Why is it so effin’ difficult to get it “working”?

Katherine-Pes-MacBook-Pro:~ katz$ search
dyld: Library not loaded: libmysqlclient.18.dylib
  Referenced from: /usr/local/bin/search
  Reason: image not found

I use sphinx only for mysql projects. But there are better options out there for sure.

This is how we fix that issue:

sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/bin/indexer

sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/bin/search

And probably every time you get a similar issue, consider using similar command. Just change the paths.

This will probably work (but not tested. I agree it is insane to use install_name_tool every time the same issue occurs.

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/