I installed mysql (5.6.27), the newest mysql version at this time(5.7..).
I have mysql2 gem installed with version - 0.3.14
When i try to run rake db:create
i get error message:
Karliss-Air:gostyling myuser$ rake db:create
dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info
Referenced from: /Users/myuser/.rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/mysql2-0.3.14/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_get_client_info
Referenced from: /Users/myuser/.rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/mysql2-0.3.14/mysql2/mysql2.bundle
Expected in: flat namespace
BUT the wierd thing is when i run nm -gU
it shows that the dylib is there:
Karliss-Air:gostyling myuser$ nm -gU /usr/local/lib/libmysqlclient.18.dylib | grep _mysql_get_client_info
0000000000002ff5 T _mysql_get_client_info
Karliss-Air:gostyling myuser$
I have tryed to define mysql path when instsalling the gem
gem pristine mysql2 -v '0.3.14' -- --with-mysql-dir=/usr/local/Cellar/mysql56/5.6.27 -–with-mysql-config=/usr/local/Cellar/mysql56/5.6.27/bin/mysql_config
It doesnt help.
I would really appriciate the help!
If you are using rvm/without rvm(just use sudo) then please use the following command which solve the issues.
rvmsudo ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-opt-lib=/usr/local/mysql/lib
else try,uninstalling mysql2 gem and then installing gem with sudo would solve it sometimes.
sudo gem uninstall mysql2
sudo gem install mysql2
or look into this: Lazy symbol binding failed when creating ruby db
Resolved the issue by reinstalling my macbook. The problem, i think, was that i installed mysql5.7 first, then tryed to use mysql56. After reinstall i installed mysql56 straight away and everything worked just fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.