[英]After running Brew Update, mysql was updated, all rails applications with mysql2 don't work
I have been on this issue for some time now. 我在这个问题上已经有一段时间了。 It happened after I ran brew upgrade.
这是在我进行Brew升级后发生的。 It installed mysql version 5.7.9.
它安装了mysql版本5.7.9。
rake aborted!
LoadError: dlopen(/Users/MyName/.rvm/gems/ruby-2.2.3@AppName/extensions/x86_64-darwin-14/2.2.0-static/mysql2-0.3.20/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/opt/mysql/lib/libmysqlclient.18.dylib
Referenced from: /Users/MyName/.rvm/gems/ruby-2.2.3@AppName/extensions/x86_64-darwin-14/2.2.0-static/mysql2-0.3.20/mysql2/mysql2.bundle
Reason: image not found - /Users/MyName/.rvm/gems/ruby-2.2.3@AppName/extensions/x86_64-darwin-14/2.2.0-static/mysql2-0.3.20/mysql2/mysql2.bundle
but when I cd into the directory 但是当我进入目录时
opt/mysql/lib master ✔ 3h36m
▶ ls
libmysqlclient.18.dylib libmysqlclient.20.dylib libmysqlclient.a libmysqlclient.dylib libmysqld.a libmysqlservices.a pkgconfig plugin
I tried all the symlink answers on this forum but still no luck. 我在这个论坛上尝试了所有的符号链接答案,但还是没有运气。 I am running El Capitan.
我正在跑步El Capitan。 I also did locate and this was the result:
我也找到了,这就是结果:
opt/mysql/lib master ✔ 3h36m
▶ locate libmysqlclient.18.dylib
/usr/local/Cellar/mysql/5.6.27/lib/libmysqlclient.18.dylib
/usr/local/lib/libmysqlclient.18.dylib
The gem mysql2 is not working for any of my rails applications. gem mysql2不适合我的任何Rails应用程序。 Everytime I run rails s, or any rake task it automatically fails.
每当我运行rails或任何rake任务时,它都会自动失败。 Running rails s gives this error:
运行rails会出现此错误:
▶ rails s
bin/rails:6: warning: already initialized constant APP_PATH
Any help is GREATLY appreciated. 任何帮助是极大的赞赏。 Please and thank you.
谢谢,麻烦您了。
so I wanted to make sure this was there for others with this problem. 所以我想确保有其他人遇到这个问题。 Wajid Kagzi 's comment was the fix for my issue as well.
Wajid Kagzi的评论也解决了我的问题。
I fixed it by reinstalling mysql from brew, then uninstalled and reinstalled the mysql2 gem from each of my versions of ruby.
我通过从brew重新安装mysql来修复它,然后从我的每个ruby版本中卸载并重新安装了mysql2 gem。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.