Ruby-on-rails 安装 mysql2 (0.3.11) 时发生错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18840020/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
An error occurred while installing mysql2 (0.3.11)
提问by HXH
I am a rails beginner,and I get a demo from https://github.com/rubytaiwan/jobs.ruby.tw
我是一个 Rails 初学者,我从https://github.com/rubytaiwan/jobs.ruby.tw得到了一个演示
but when I try to run this demo,I got an error.
但是当我尝试运行此演示时,出现错误。
I run follow
我跟着跑
bundle
I got the error
我得到了错误
An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
but I can sure I have install mysql2
但我可以确定我已经安装了 mysql2
and the Gemfileis
并且Gemfile是
source 'https://rubygems.org'
ruby "1.9.3"
gem 'rails', '~> 3.2.12'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'devise', '~>2.1.3'
gem 'mysql2'
gem "babosa"
gem "rails_autolink"
gem "settingslogic"
gem "seo_helper"
gem 'open_graph_helper'
gem 'google_plus_helper'
gem 'exception_notification'
gem "mobile-fu"
gem 'capistrano', :group => "development"
gem 'rake', :group => :test
group :development do
gem "capistrano"
gem "magic_encoding"
gem "annotate"
end
group :test, :development do
gem "rspec"
gem "rspec-rails"
gem "simplecov"
gem "capybara"
end
then I try to comment this row:
然后我尝试评论这一行:
gem 'mysql2'
but I still got the error. so I do not know why this error occurs
但我仍然遇到错误。所以我不知道为什么会出现这个错误
回答by MicRum
try it
尝试一下
sudo apt-get install mysql-client libmysqlclient-dev
回答by violentr
@Ricardo Masao Shigeoka for the mac ,try first
@Ricardo Masao Shigeoka for mac,先试试
brew install mysql, then
brew install mysql, 然后
Put in your Gemfile gem 'mysql2', '0.3.18'
放入你的 Gemfile gem 'mysql2', '0.3.18'
run bundlecommand in terminal.
bundle在终端中运行命令。
This setup worked for me, I have El Captain OS, rails 4.2.6, hope this helps
这个设置对我有用,我有 El Captain OS,rails 4.2.6,希望这有帮助
回答by Ryosuke Hujisawa
Try this one
试试这个
gem 'mysql2', '~> 0.4.10'

