安装MySQL Rail应用程序包

时间:2013-01-22 20:37:12

标签: ruby-on-rails gem ruby-on-rails-3.2

一段时间后,当我说bundle install时,我收到错误:

  

记录结果   /Users/JonyIve/.rvm/gems/ruby-1.9.3-p362@railsbabak/gems/mysql2-0.3.11/ext/mysql2/gem_make.out   安装mysql2(0.3.11)时发生错误,而Bundler不能   继续。确保gem install mysql2 -v '0.3.11'成功   在捆绑之前。

所以我按照它说的做,我运行这个命令:

gem install mysql2 -v '0.3.11'

然后我再次运行Bundle Install但是我又得到了同样的错误。

我应该从哪里开始寻找解决此问题的方法?

以下是我的GemFile的样子:

source 'https://rubygems.org'

gem 'rails', '3.2.6'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
#START:mysql
group :production do
  gem 'mysql2'
end
#END:mysql

# Gems used only for assets and not required
# in production environments by default.
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

gem 'jquery-rails'

# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
#START_HIGHLIGHT
gem 'capistrano'
#END_HIGHLIGHT

# To use debugger
# gem 'debugger'

gem 'will_paginate', '~> 3.0'

1 个答案:

答案 0 :(得分:1)

此错误的原因可能是由于缺少mysql标头,因此请确保已正确安装mysql标头。

对于Ubuntu / Linux flavor,使用以下命令安装MySQL客户端和开发包

sudo apt-get install mysql-client libmysqlclient-dev

对于mac OS:

http://www.djangoapp.com/blog/2011/07/24/installation-of-mysql-server-on-mac-os-x-lion/

问候!