我无法rake db:create
在我的生产环境中做任何事情。
我已经运行gem install activerecord-mysql2-adapter
,gem install mysql2
但两者都已经安装,所以我不明白为什么我收到以下错误消息:
rake aborted!
Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (mysql2 is not part of the bundle. Add it to Gemfile.)
/usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:214:in `block in replace_gem'
/var/www/tools/vendor/cache/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/mysql2_adapter.rb:3:in `<top (required)>'
/var/www/tools/vendor/cache/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require'
/var/www/tools/vendor/cache/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `block in require'
/var/www/tools/vendor/cache/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:236:in `load_dependency'
/var/www/tools/vendor/cache/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require'
/var/www/tools/vendor/cache/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection'
/var/www/tools/vendor/cache/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_specification.rb:29:in `spec'
/var/www/tools/vendor/cache/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection'
/var/www/tools/vendor/cache/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/railties/databases.rake:101:in `create_database'
/var/www/tools/vendor/cache/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/railties/databases.rake:62:in `block (3 levels) in <top (required)>'
/var/www/tools/vendor/cache/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/railties/databases.rake:62:in `each'
/var/www/tools/vendor/cache/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/railties/databases.rake:62:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p247@rails3-bootstrap-devise-cancan/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p247@rails3-bootstrap-devise-cancan/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:create
什么会导致这个问题?
以下是我database.yml
在config
文件夹中的文件。当我改变production
它sqlite3
时:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test: &test
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: mysql2
encoding: utf8
database: tools
username: root
password: pass
host: 127.0.0.1
port: 3306
cucumber:
<<: *test