在Fedora 17上安装Redmine时出现mysql2适配器问题

时间:2012-11-20 02:19:37

标签: ruby-on-rails redmine

我试图在Redmine后面Fedora 17上安装RAILS_ENV=production rake db:migrate

直到此步骤:

rake aborted! Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (cannot load such file -- mysql2/mysql2) /var/www/redmine/lib/plugins/acts_as_activity_provider/init.rb:2:in `block in <top (required)>' /var/www/redmine/config/initializers/00-core_plugins.rb:12:in `eval' /var/www/redmine/config/initializers/00-core_plugins.rb:12:in `block in <top (required)>' /var/www/redmine/config/initializers/00-core_plugins.rb:2:in `each' /var/www/redmine/config/initializers/00-core_plugins.rb:2:in `<top (required)>' /var/www/redmine/config/environment.rb:14:in `<top (required)>' Tasks: TOP => db:migrate => environment

会抛出错误说:

bundle show
...
* mysql2 (0.3.11)//***which is right in the bundle show list***
...

这很奇怪,因为我已经用bundle安装了mysql2:

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: 123456
  encoding: utf8

我的database.yml就像:

    ruby 1.9.3p327 (2012-11-10 revision 37606) [i386-linux]
    Rails 3.2.8                                          
    gem 1.8.24
    mysql  Ver 14.14 Distrib 5.5.28, for Linux (i686) using readline 5.1
    Redmine 2.1.3

其他我参与其中

ln -s /usr/local/share/gems/gems/mysql2-0.3.11/lib /usr/share/ruby/mysql2

我在谷歌找到了一些相关的问题,例如:this 我按照他们的说法添加了符号链接

rake aborted!
uninitialized constant Mysql2::Client::REMEMBER_OPTIONS

然后完全按照页面中的内容发布:

{{1}}

我尝试做#6中发布的内容,但它对我不起作用。 这是解决我的问题的正确方法,我应该怎么处理第二个错误。

3 个答案:

答案 0 :(得分:2)

在您的gemfile中添加gem 'mysql2'并运行bundle install,然后执行RAILS_ENV=production rake db:migrate

答案 1 :(得分:2)

如果您正在使用Fedora的ruby,请尝试:

yum install ruby-mysql

如果您正在使用RVM或任何其他类似工具,请安装mysql的开发包,然后重新安装ruby mysql gem。

yum install mysql-devel

答案 2 :(得分:1)

> add gem "minitest" into Gemfile
> gem list | cut -d" " -f1 | xargs gem uninstall -aIx
> yum erase rubygem-activesupport-3.0.11-5.fc17.noarch
> yum install rubygem-bundler
> bundle install
> then other steps, this works!!

有关详细信息,请参阅this 谢谢!