Redmine 安装-Ruby MySQL 连接器问题

Redmine 安装-Ruby MySQL 连接器问题

我正在尝试从 TRAC 迁移到 Redmine,
但在安装过程中遇到了问题。

我按照以下安装指南进行操作:http://www.redmine.org/projects/redmine/wiki/RedmineInstall
一切都好起来了……

  • 在 MySQL5.5 中创建了 redmine 数据库(空),添加了用户 redmine,并使用“my_password”作为密码进行测试

  • 执行后,按照建议将 mysqllib.dll 从复制MySQL Connector/C 6.0.2c:\ruby193\binbundle install -without rmagick

  • 编辑database.yml

生产:
适配器:mysql2
数据库:redmine
主机:localhost
用户名:redmine
密码:my_password

  • 然后set RAILS_ENV=production

  • 当我尝试使用生成表时rake db:migrate
    出现以下错误(additng--trace):

    C:\Program Files (x86)\redMine 2.1-stable>rake db:migrate --trace
    ** Invoke db:migrate (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    rake aborted!
    Can't connect to MySQL server on 'localhost' (10061)
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/client.rb:44:in `connect'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/client.rb:44:in `initialize'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:309:in `new_connection'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:319:in `checkout_new_connection'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:241:in `block (2 levels) in checkout'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `loop'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `block in checkout'
    C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:233:in `checkout'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:96:in `block in connection'
    C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in `retrieve_connection'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:170:in `retrieve_connection'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:144:in `connection'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:308:in `clear_cache!'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/railtie.rb:97:in `block (2 levels) in <class:Railtie>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:418:in `_run__792713192__prepare__98754910__callbacks'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
    C:/Program Files (x86)/redMine 2.1-stable/config/environment.rb:14:in `<top (required)>'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:103:in `require'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:103:in `require_environment!'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:295:in `block (2 levels) in initialize_tasks'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:227:in `call'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:227:in `block in execute'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:222:in `each'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:222:in `execute'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
    C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:187:in `block in invoke_prerequisites'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:185:in `each'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:185:in `invoke_prerequisites'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
    C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:152:in `invoke'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:141:in `invoke_task'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:99:in `block (2 levels) in top_level'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:99:in `each'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:99:in `block in top_level'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:108:in `run_with_threads'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:93:in `top_level'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:71:in `block in run'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
    C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.2/bin/rake:37:in `<top (required)>'
    C:/Ruby193/bin/rake:23:in `load'
    C:/Ruby193/bin/rake:23:in `<main>'
    Tasks: TOP => db:migrate => environment
    

版本信息:
Windows 7 x64 Professional
MySql 5.5.4
MySql Connector/C 6.0.2
ruby​​ -v => ruby​​ 1.9.3p327 (2012-11-10) [i386-mingw32]
gem -v => 1.8.24

  • 使用 MySQL Workbench 测试登录...工作正常。

请帮忙,我应该检查什么?

答案1

嗯,真是太棒了!
是的,这是一篇对自己生气的帖子:)

经过一个小时的努力寻找解决方案后,我发布了这个问题......

发布这个问题 5 分钟后,我在 StackOverflow 上看到了解决方案......
https://stackoverflow.com/questions/10892689/cant-connect-to-mysql-server-on-localhost-10061-after-installation

不但不能用localhost
,还要用127.0.0.1代替!

美丽...我觉得自己很蠢...但最好是这样...
希望没有人再需要处理这个问题:~)

相关内容