This error happens when mysql2 gem is either installed for some other version of mysql or when it cannot find required dynamic library. To fix this error, uninstall mysql2 gem and install as follows
$ env ARCHFLAGS="-arch x86_64" gem install mysql2 -v='0.3.11' -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config
Please change ‘/usr/local/mysql’ to your mysql installation path. Thank you.