Для обновления Redmine с 1.0.1 до 2.1.2 мне нужно выполнить команду: rake db:migrate RAILS_ENV=production
Однако при этом возникает следующая ошибка: rake aborted!
Please install the mysql2 adapter: gem install activerecord-mysql2-adapter (mysql2 is not part of the bundle. Add it to Gemfile.)
Я бежал gem install activerecord-mysql2-adapter
, но я все равно получаю ту же ошибку, когда пытаюсь запустить rake ...
команда.
Как мне заставить мое приложение RoR распознавать, что у меня уже установлен адаптер mysql2? или Что-то не так с моей установкой activerecord-mysql2-adapter?
Результаты 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
Результаты 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
Содержание /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 :openid 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
end
platforms :mri_18, :mingw_18 do
group :mysql do
gem "mysql"
end
end
platforms :mri_19, :mingw_19 do
group :mysql do
gem "mysql2", "~> 0.3.11"
end
end
platforms :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
end
group :development do
gem "rdoc", ">= 2.4.2"
gem "yard"
end
group :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"
end
local_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
Содержание /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
ruby
DEPENDENCIES
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
Результаты 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)
Результаты 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)
Как вы можете видеть в Gemfile
, Redmine использует два разных гема адаптера MySQL в зависимости от версии ruby. В Ruby 1.8 он использует mysql
драгоценный камень, с Ruby 1.9, mysql2
драгоценный камень.
Эти два камня нужно настроить немного по-разному в database.yml
, как adapter
имя совпадает с именем драгоценного камня. В вашем случае вам необходимо настроить adapter
так как mysql
в твоем database.yml
.
Если вы настроите неправильный адаптер (то есть тот, который недоступен), вы получите часто вводящее в заблуждение сообщение об ошибке для установки activerecord-<configured adapter name>-adapter
драгоценный камень, который на самом деле большую часть времени называют чем-то другим.
Потратив на это целый вечер, у меня сработали следующие изменения в Gemfile:
# platforms :mri_18, :mingw_18 do
# group :mysql do
# gem "mysql"
# end
# end
platforms :mri_18, :mingw_18, :mri_19, :mingw_19 do
group :mysql do
gem "mysql2", "~> 0.3.11"
end
end
Тогда беги
bundle update
Бег bundle install
в корневом каталоге Redmine, вероятно, решит эту проблему. Но в вашем сообщении я не вижу, какую версию Redmine вы используете и до какой версии обновляетесь. Сомневаетесь, следуйте http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade а также http://www.redmine.org/projects/redmine/wiki/RedmineInstall при обновлении основной версии.