在Ubuntu上rails mysql gem问题 [英] rails mysql gem problem on ubuntu

查看:122
本文介绍了在Ubuntu上rails mysql gem问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ruby on Rails:
我想在本地主机上调用一个控制器,但服务器说!缺少MySQL宝石。把它添加到你的Gemfile中:gem'mysql','2.8.1'

这个问题?当我点击'gem list'命令时,我得到了一个包含mysql 2.8.1的列表。所以宝石已经安装!为什么无法看到webrick?



谢谢。

解决方案

您需要将 gem'mysql','2.8.1'这一行添加到您的Gemfile中。然后在Rails项目的根文件夹中输入 bundle install 。这听起来像是你忘了运行打包程序。



MySQL gem确实需要本机C扩展。所以你需要确保你已经安装了所有的开发库。



在Ubuntu中,您可以这样做:

  sudo apt -get install mysql-server mysql-client 
sudo apt-get install libmysql-ruby libmysqlclient-dev $ b $ sudo gem install mysql

如果您使用的是rvm,请不要将宝石安装为sudo。



只要确认,您可能也想尝试删除你的Gemfile.lock,然后重新运行 bundle install


Ruby on Rails: I would like to call a controller on the localhost, but the server said !!! Missing the mysql gem. Add it to your Gemfile: gem 'mysql', '2.8.1'

The problem ? When I hit 'gem list' command then I got a list witch is containing the mysql 2.8.1 . So the gem is INSTALLED ! WHY can't it see by the webrick ?

Thank you.

解决方案

You need to add the line gem 'mysql', '2.8.1' to your Gemfile. Then type bundle install in the root folder of your Rails project. It sounds like you forgot to run bundler.

The MySQL gem does require native C extensions. So you'll need to make sure that you have all the development libraries installed.

In Ubuntu you can do something like this:

sudo apt-get install mysql-server mysql-client
sudo apt-get install libmysql-ruby libmysqlclient-dev
sudo gem install mysql

If you are using rvm, do not install gems as sudo.

Just to make sure, you might also want to try removing your Gemfile.lock and then re-running bundle install

这篇关于在Ubuntu上rails mysql gem问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆