rails mysql gem problem on ubuntu

筅森魡賤 提交于 2019-12-04 10:43:21

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

It seems that you are using Rails 3 which uses bundler to load all needed gem. You should add the gem to your Gemfile as instructed by the error message so that it will be loaded. Checkout the bundler project page for more information about the gem dependency tool and how to use it with Rails. http://gembundler.com/rails3.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!