Command rake db:schema:dump not working properly

Solution 1:

You need to install mysql. I recommend installing a package manager such as Homebrew, then doing a simple brew install mysql

Solution 2:

Your are probably missing something about a correct installation on osx and with a correct distribution of mysql libraries.
The fastest way of getting rid of this problem was a:

$ sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

use the

$ sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql-5.5.15-osx10.6-x86_64/lib/libmysqlclient.18.dylib /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle

should be the proper solution

Note: Copied from here