On Mac OS Lion, with mysql installed from source, might get following error when trying to access mysql from rails:
Library not loaded: libmysqlclient.18.dylib (LoadError)
There are two solutons:
export DLYD_LIBRARY_PATH=/usr/local/mysql/libinto bash profile, somehow, it will raise warning time to time in Lion and ML: 'dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/osascript) is code signed with entitlements', things like that.
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib, this works for me.
I bet there must be a better solution to do with the compile options when build from mysql source, untill them, second solution will work for me.