[英]Can't Run my server in rails after upgrading to ubuntu 12.04
I just upgraded ubuntu from 11.10 to 12.04 and after that when I run my server inside my rails project I got this error 我刚刚将ubuntu从11.10升级到12.04,之后当我在我的rails项目中运行我的服务器时出现了这个错误
$ rails s
/usr/share/ruby-rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require':
libmysqlclient_r.so.16: cannot open shared object file: No such file or directory -
/usr/share/ruby-rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11/lib/mysql2/mysql2.so (LoadError)
any help please? 有什么帮助吗?
Go to your project and follow the steps, 转到您的项目并按照步骤操作,
rvm gemset empty <gemset name>
gem install bundler
bundle install
It will solve your problem. 它会解决你的问题。
If that does not work, or if you are not using rvm, please use 如果这不起作用,或者如果您不使用rvm,请使用
gem uninstall mysql2
bundle install
from one of your mysql2-using Rails project's directory. 来自你的一个使用Rails项目的mysql2目录。
I followed Babak's instruction that he posted and it worked after a small change. 我遵循巴巴克的 指示 ,他发布了一个小的改变后它的工作。
My system is Ubuntu 12.04 server and it has Ruby1.9.3 installed so I did this 我的系统是Ubuntu 12.04服务器,它安装了Ruby1.9.3所以我这样做了
sudo apt-get install mysql-server libmysqlclient-dev
Seems like the libmysqlclient16-dev is now renamed to libmysqlclient-dev in Ubuntu 12.04 好像libmysqlclient16-dev现在在Ubuntu 12.04中重命名为libmysqlclient-dev
Afterwards I ran 然后我跑了
gem install mysql2
Well, I would suggest double checking the ruby and the rails version and make sure they are the same ones u created your project with. 好吧,我建议仔细检查ruby和rails版本,并确保它们与你创建的项目相同。 Maybe you have to change the version using rvm: 也许你必须使用rvm更改版本:
rvm use 'Version'
Maybe you can uninstall and reinstall the mysql packages again, also try installing: 也许您可以再次卸载并重新安装mysql软件包,也可以尝试安装:
sudo apt-get install mysql-client mysql-server libmysqlclient16-dev
or 要么
sudo apt-get install mysql-client mysql-server libmysqlclient-dev
Also try uninstalling and reinstalling your mysql gem. 还尝试卸载并重新安装mysql gem。 This blog post had a solution for this error as well, although the error was cause at a different time. 这篇博文也有一个解决这个错误的方法,虽然错误是在不同的时间引起的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.