For upgrading Redmine from 1.0.1 to 2.1.2, I need to execute the command: rake db:migrate RAILS_ENV=production
However, doing so produces the following error: rake aborted!
Please install the mysql2 adapter: gem install activerecord-mysql2-adapter (mysql2 is not part of the bundle. Add it to Gemfile.)
I have ran gem install activerecord-mysql2-adapter
, but I still get the same error when I try to run the rake ...
command.
How do I get my RoR app to recognize that I have the mysql2 adapter installed already? or Is there something wrong with my activerecord-mysql2-adapter installation?
Results of sudo bundle install
:
Using rake (10.0.0)
Using i18n (0.6.1)
Using multi_json (1.3.7)
Using activesupport (3.2.8)
Using builder (3.0.0)
Using activemodel (3.2.8)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.8)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.8)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.8)
Using activeresource (3.2.8)
Using coderay (1.0.8)
Using fastercsv (1.5.5)
Using rack-ssl (1.3.2)
Using json (1.7.5)
Using rdoc (3.12)
Using thor (0.16.0)
Using railties (3.2.8)
Using jquery-rails (2.0.3)
Using metaclass (0.0.1)
Using mocha (0.12.3)
Using mysql (2.8.1)
Using net-ldap (0.3.1)
Using pg (0.14.1)
Using ruby-openid (2.1.8)
Using rack-openid (1.3.1)
Using bundler (1.2.1)
Using rails (3.2.8)
Using rmagick (2.13.1)
Using shoulda (2.11.3)
Using sqlite3 (1.3.6)
Using yard (0.8.3)
[32mYour bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.[0m
Results of sudo find / -name "*mysql2*"
:
/var/lib/gems/1.8/doc/mysql2-0.3.11
/var/lib/gems/1.8/doc/activerecord-3.2.9/ri/ActiveRecord/Base/mysql2_connection-c.ri
/var/lib/gems/1.8/doc/activerecord-mysql2-adapter-0.0.3
/var/lib/gems/1.8/doc/activerecord-mysql2-adapter-0.0.3/ri/ActiveRecord/Base/em_mysql2_connection-c.ri
/var/lib/gems/1.8/doc/activerecord-mysql2-adapter-0.0.3/ri/ActiveRecord/Base/mysql2_connection-c.ri
/var/lib/gems/1.8/gems/mysql2-0.3.11
/var/lib/gems/1.8/gems/mysql2-0.3.11/spec/mysql2
/var/lib/gems/1.8/gems/mysql2-0.3.11/mysql2.gemspec
/var/lib/gems/1.8/gems/mysql2-0.3.11/lib/mysql2.rb
/var/lib/gems/1.8/gems/mysql2-0.3.11/lib/mysql2
/var/lib/gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.so
/var/lib/gems/1.8/gems/mysql2-0.3.11/ext/mysql2
/var/lib/gems/1.8/gems/mysql2-0.3.11/ext/mysql2/mysql2.so
/var/lib/gems/1.8/gems/mysql2-0.3.11/ext/mysql2/mysql2_ext.c
/var/lib/gems/1.8/gems/mysql2-0.3.11/ext/mysql2/mysql2_ext.h
/var/lib/gems/1.8/gems/mysql2-0.3.11/ext/mysql2/mysql2_ext.o
/var/lib/gems/1.8/gems/activerecord-3.2.9/lib/active_record/connection_adapters/mysql2_adapter.rb
/var/lib/gems/1.8/gems/activerecord-mysql2-adapter-0.0.3
/var/lib/gems/1.8/gems/activerecord-mysql2-adapter-0.0.3/activerecord-mysql2-adapter.gemspec
/var/lib/gems/1.8/gems/activerecord-mysql2-adapter-0.0.3/lib/arel/engines/sql/compilers/mysql2_compiler.rb
/var/lib/gems/1.8/gems/activerecord-mysql2-adapter-0.0.3/lib/activerecord-mysql2-adapter.rb
/var/lib/gems/1.8/gems/activerecord-mysql2-adapter-0.0.3/lib/activerecord-mysql2-adapter
/var/lib/gems/1.8/gems/activerecord-mysql2-adapter-0.0.3/lib/active_record/connection_adapters/em_mysql2_adapter.rb
/var/lib/gems/1.8/gems/activerecord-mysql2-adapter-0.0.3/lib/active_record/connection_adapters/mysql2_adapter.rb
/var/lib/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/mysql2_adapter.rb
/var/lib/gems/1.8/cache/mysql2-0.3.11.gem
/var/lib/gems/1.8/cache/activerecord-mysql2-adapter-0.0.3.gem
/var/lib/gems/1.8/specifications/activerecord-mysql2-adapter-0.0.3.gemspec
/var/lib/gems/1.8/specifications/mysql2-0.3.11.gemspec
Contents of /usr/share/redmine/Gemfile
:
source 'http://rubygems.org'gem 'rails', '3.2.8'
gem "jquery-rails", "~> 2.0.2"
gem "i18n", "~> 0.6.0"
gem "coderay", "~> 1.0.6"
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
gem "builder", "3.0.0"# Optional gem for LDAP authentication
group :ldap do
gem "net-ldap", "~> 0.3.1"
end# Optional gem for OpenID authentication
group penid do
gem "ruby-openid", "~> 2.1.4", :require => "openid"
gem "rack-openid"
end# Optional gem for exporting the gantt to a PNG file, not supported with jruby
platforms :mri, :mingw do
group :rmagick do
# RMagick 2 supports ruby 1.9
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
# different requirements for the same gem on different platforms
gem "rmagick", ">= 2.0.0"
end
end# Database gems
platforms :mri, :mingw do
group :postgresql do
gem "pg", ">= 0.11.0"
end group :sqlite do
gem "sqlite3"
end
endplatforms :mri_18, :mingw_18 do
group :mysql do
gem "mysql"
end
endplatforms :mri_19, :mingw_19 do
group :mysql do
gem "mysql2", "~> 0.3.11"
end
endplatforms :jruby do
gem "jruby-openssl" group :mysql do
gem "activerecord-jdbcmysql-adapter"
end group :postgresql do
gem "activerecord-jdbcpostgresql-adapter"
end group :sqlite do
gem "activerecord-jdbcsqlite3-adapter"
end
endgroup :development do
gem "rdoc", ">= 2.4.2"
gem "yard"
endgroup :test do
gem "shoulda", "~> 2.11"
# Shoulda does not work nice on Ruby 1.9.3 and seems to need test-unit explicitely.
gem "test-unit", :platforms => [:mri_19]
gem "mocha", "0.12.3"
endlocal_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
if File.exists?(local_gemfile)
puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v`
instance_eval File.read(local_gemfile)
end# Load plugins' Gemfiles
Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
instance_eval File.read(file)
end
Contents of /usr/share/redmine/Gemfile.lock
:
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.8)
actionpack (= 3.2.8)
mail (~> 2.4.4)
actionpack (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.3)
activemodel (3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
activerecord (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
activesupport (3.2.8)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.0)
coderay (1.0.8)
erubis (2.7.0)
fastercsv (1.5.5)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.0.3)
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
json (1.7.5)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.1)
mime-types (1.19)
mocha (0.12.3)
metaclass (~> 0.0.1)
multi_json (1.3.7)
mysql (2.8.1)
mysql2 (0.3.11)
net-ldap (0.3.1)
pg (0.14.1)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-openid (1.3.1)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-ssl (1.3.2)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.8)
actionmailer (= 3.2.8)
actionpack (= 3.2.8)
activerecord (= 3.2.8)
activeresource (= 3.2.8)
activesupport (= 3.2.8)
bundler (~> 1.0)
railties (= 3.2.8)
railties (3.2.8)
actionpack (= 3.2.8)
activesupport (= 3.2.8)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.0)
rdoc (3.12)
json (~> 1.4)
rmagick (2.13.1)
ruby-openid (2.1.8)
shoulda (2.11.3)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
test-unit (2.5.2)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.35)
yard (0.8.3)PLATFORMS
rubyDEPENDENCIES
activerecord-jdbcmysql-adapter
activerecord-jdbcpostgresql-adapter
activerecord-jdbcsqlite3-adapter
builder (= 3.0.0)
coderay (~> 1.0.6)
fastercsv (~> 1.5.0)
i18n (~> 0.6.0)
jquery-rails (~> 2.0.2)
jruby-openssl
mocha (= 0.12.3)
mysql
mysql2 (~> 0.3.11)
net-ldap (~> 0.3.1)
pg (>= 0.11.0)
rack-openid
rails (= 3.2.8)
rdoc (>= 2.4.2)
rmagick (>= 2.0.0)
ruby-openid (~> 2.1.4)
shoulda (~> 2.11)
sqlite3
test-unit
yard
Results of gem list
:
actionmailer (3.2.9, 3.2.8)
actionpack (3.2.9, 3.2.8)
activemodel (3.2.9, 3.2.8)
activerecord (3.2.9, 3.2.8)
activerecord-mysql2-adapter (0.0.3)
activeresource (3.2.9, 3.2.8)
activesupport (3.2.9, 3.2.8)
arel (3.0.2)
builder (3.0.0)
bundler (1.2.1)
coderay (1.0.8)
erubis (2.7.0)
fastercsv (1.5.5)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.0.3)
json (1.7.5)
mail (2.4.4)
metaclass (0.0.1)
mime-types (1.19)
mocha (0.12.3)
multi_json (1.3.7)
mysql (2.8.1)
mysql2 (0.3.11)
net-ldap (0.3.1)
pg (0.14.1)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-openid (1.3.1)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.9, 3.2.8)
railties (3.2.9, 3.2.8)
rake (10.0.0)
rdoc (3.12)
rmagick (2.13.1)
ruby-openid (2.1.8)
shoulda (2.11.3)
sprockets (2.2.1, 2.1.3)
sqlite3 (1.3.6)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35)
yard (0.8.3)
Results of bundle show
:
Gems included by the bundle:
* actionmailer (3.2.8)
* actionpack (3.2.8)
* activemodel (3.2.8)
* activerecord (3.2.8)
* activeresource (3.2.8)
* activesupport (3.2.8)
* arel (3.0.2)
* builder (3.0.0)
* bundler (1.2.1)
* coderay (1.0.8)
* erubis (2.7.0)
* fastercsv (1.5.5)
* hike (1.2.1)
* i18n (0.6.1)
* journey (1.0.4)
* jquery-rails (2.0.3)
* json (1.7.5)
* mail (2.4.4)
* metaclass (0.0.1)
* mime-types (1.19)
* mocha (0.12.3)
* multi_json (1.3.7)
* mysql (2.8.1)
* net-ldap (0.3.1)
* pg (0.14.1)
* polyglot (0.3.3)
* rack (1.4.1)
* rack-cache (1.2)
* rack-openid (1.3.1)
* rack-ssl (1.3.2)
* rack-test (0.6.2)
* rails (3.2.8)
* railties (3.2.8)
* rake (10.0.0)
* rdoc (3.12)
* rmagick (2.13.1)
* ruby-openid (2.1.8)
* shoulda (2.11.3)
* sprockets (2.1.3)
* sqlite3 (1.3.6)
* thor (0.16.0)
* tilt (1.3.3)
* treetop (1.4.12)
* tzinfo (0.3.35)
* yard (0.8.3)
As you can see in the Gemfile
, Redmine uses two different MySQL adapter gems depending on the ruby version. With Ruby 1.8, it uses the mysql
gem, with Ruby 1.9, the mysql2
gem.
These two gems need to be configured slightly differently in the database.yml
, as the adapter
name is the same as the gemname. In your case, you need to configure the adapter
as mysql
in your database.yml
.
If you configure the wrong adapter (i.e. one that is not available), you get the often misleading error message to install the activerecord-<configured adapter name>-adapter
gem, which is in fact called something else most of the time.
Check more discussion of this question.