2.0.3. installation - migrate says "undefined method 'init' for Mysql:Class"

Added by Libor Sakmary almost 10 years ago

Hi,

I'm installing Redmine 2.0.3. However, I get the error "undefined method 'init' for Mysql:Class" when running 'RAILS_ENV=production rake db:migrate'. Any idea?

Thanks,
Libor

Trace:
  • Invoke db:migrate (first_time)
  • Invoke environment (first_time)
  • Execute environment
    rake aborted!
    undefined method `init' for Mysql:Class
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/mysql_adapter.rb:32:in `mysql_connection'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:309:in `send'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:309:in `new_connection'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:319:in `checkout_new_connection'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:241:in `checkout'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `loop'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `checkout'
    /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:233:in `checkout'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:96:in `connection'
    /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in `retrieve_connection'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:308:in `clear_cache!'
    /var/lib/gems/1.8/gems/activerecord-3.2.6/lib/active_record/railtie.rb:97:in `_callback_before_3'
    /var/lib/gems/1.8/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:418:in `_run__1668811562__prepare__4__callbacks'
    /var/lib/gems/1.8/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `send'
    /var/lib/gems/1.8/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `__run_callback'
    /var/lib/gems/1.8/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
    /var/lib/gems/1.8/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in `send'
    /var/lib/gems/1.8/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /var/lib/gems/1.8/gems/actionpack-3.2.6/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
    /var/lib/gems/1.8/gems/actionpack-3.2.6/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
    /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/application/finisher.rb:47
    /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
    /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
    /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `run_initializers'
    /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
    /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
    /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
    /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `send'
    /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
    /home/libor/workspace/redmine-2.0.3/config/environment.rb:14
    /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/application.rb:103:in `require'
    /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/application.rb:103:in `require_environment!'
    /var/lib/gems/1.8/gems/railties-3.2.6/lib/rails/application.rb:292:in `initialize_tasks'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
    /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `invoke_prerequisites'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `invoke_with_call_chain'
    /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
    /var/lib/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
    /usr/local/bin/rake:19:in `load'
    /usr/local/bin/rake:19
    Tasks: TOP => db:migrate => environment

Replies (1)

RE: 2.0.3. installation - migrate says "undefined method 'init' for Mysql:Class" - Added by Diego Balboa Sarille about 8 years ago

I had this errot in my pidora (Fedora for rasberry pi) for redmine 2.4 I resolved

Change the mysql adapter. Edit config/database.yml

old text

production:
  adapter: mysql
  database: redmine
  host: localhost
  username: root
  password: "password" 
  encoding: utf8

new text

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

run "RAILS_ENV=production rake db:migrate"

sorry for my english

(1-1/1)