我正在尝试遵循这个Redmine 设置教程。当我开始启动服务器时,我输入sudo rails server
并收到以下错误:
Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (mysql2 is not part of the bundle. Add it to Gemfile.) (LoadError)
我的 Gemfile 的相关部分内容如下:
....
if File.exist?(database_file)
database_config = YAML::load(ERB.new(IO.read(database_file)).result)
adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
if adapters.any?
adapters.each do |adapter|
case adapter
when /mysql/
gem "mysql", "~> 2.8.1", :platforms => [:mri_18, :mingw_18]
gem "mysql2", "~> 0.3.11", :platforms => [:mri_19, :mingw_19]
gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
...
并且 Gemfile.lock 包含 mysql2:
...
multi_json (1.5.0)
mysql (2.8.1)
mysql2 (0.3.11)
net-ldap (0.3.1)
...
我的 database.yml 文件包括以下内容:
...
production:
adapter: mysql2
database: redmine
host: localhost
username: ****
password: ****
development:
adapter: mysql2
database: redmine_development
host: localhost
username: ****
password: ****
encoding: utf8
...
运行bundle install
好像成功了,但是输出中没有列出mysql2,which mysql2
什么都不返回,又bundle show mysql2
返回Could not find gem 'mysql2' in the current bundle.
我已经卸载并重新安装了 mysql2 gem,每次都取得了明显的成功。
我已经阅读了关于其他 stackoverflow 问题的类似问题的描述,但他们的解决方案都没有解决我的问题。