Redmine安装问题rake命令问题,MySQL数据库问题?

Redmine安装问题rake命令问题,MySQL数据库问题?

我遇到了一个有点复杂的问题,涉及几个不同的程序,包括 redmine、MySQL、Ruby、Ruby on Rails 等。这是在 Windows XP 上。

我正在遵循这里的redmine说明:http://www.redmine.org/projects/redmine/wiki/RedmineInstall

我在第 5 步,我应该输入RAILS_ENV=production rake db:migrate

当我在命令提示符下输入此内容并按回车键时,出现错误:

“RAILS_ENV” 不是一个命令等等。

因此我将其重新排序为:rake db:migrate RAILS_ENV=production

这似乎工作正确,但我得到以下结果:

C:\redmine-1.2.1>rake db:migrate RAILS_ENV=production --trace
NOTE: SourceIndex.new(hash) is deprecated; From C:/redmine-1.2.1/config/../vendo
r/rails/railties/lib/rails/vendor_gem_source_index.rb:100:in `new'.
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
WARNING: 'task :t, arg, :needs => [deps]' is deprecated. Please use 'task :t, [
args] => [deps]' instead.
at C:/redmine-1.2.1/lib/tasks/email.rake:170

    * Invoke db:migrate (first_time)
    * Invoke environment (first_time)
    * Execute environment
      rake aborted!
      Access denied for user 'redmine'@'localhost' (using password: YES)
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /mysql_adapter.rb:620:in `real_connect'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /mysql_adapter.rb:620:in `connect'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /mysql_adapter.rb:203:in `initialize'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /mysql_adapter.rb:75:in `new'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /mysql_adapter.rb:75:in `mysql_connection'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /abstract/connection_pool.rb:223:in `send'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /abstract/connection_pool.rb:223:in `new_connection'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /abstract/connection_pool.rb:245:in `checkout_new_connection'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /abstract/connection_pool.rb:188:in `checkout'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /abstract/connection_pool.rb:184:in `loop'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /abstract/connection_pool.rb:184:in `checkout'
      C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /abstract/connection_pool.rb:183:in `checkout'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /abstract/connection_pool.rb:98:in `connection'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /abstract/connection_pool.rb:326:in `retrieve_connection'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /abstract/connection_specification.rb:123:in `retrieve_connection'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/connection_adapters
      /abstract/connection_specification.rb:115:in `connection'
      C:/redmine-1.2.1/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:217
      :in `quoted_left_column_name'
      C:/redmine-1.2.1/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:93:
      in `acts_as_nested_set'
      C:/redmine-1.2.1/app/models/issue.rb:37
      C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:53:in `gem_original
      _require'
      C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:53:in `require'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      84:in `require'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:2
      91:in `require_or_load_without_engine_additions'
      C:/redmine-1.2.1/vendor/plugins/engines/lib/engines/rails_extensions/dependencie
      s.rb:132:in `require_or_load'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:4
      51:in `load_missing_constant'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      06:in `const_missing'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      18:in `const_missing'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:4
      63:in `load_missing_constant'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      22:in `const_missing'
      C:/redmine-1.2.1/app/models/project.rb:40
      C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:53:in `gem_original
      _require'
      C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:53:in `require'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      84:in `require'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:2
      91:in `require_or_load_without_engine_additions'
      C:/redmine-1.2.1/vendor/plugins/engines/lib/engines/rails_extensions/dependencie
      s.rb:132:in `require_or_load'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:4
      51:in `load_missing_constant'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      06:in `const_missing'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      18:in `const_missing'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:4
      63:in `load_missing_constant'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      22:in `const_missing'
      C:/redmine-1.2.1/app/models/attachment.rb:36
      C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:53:in `gem_original
      _require'
      C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:53:in `require'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      84:in `require'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:2
      91:in `require_or_load_without_engine_additions'
      C:/redmine-1.2.1/vendor/plugins/engines/lib/engines/rails_extensions/dependencie
      s.rb:132:in `require_or_load'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:4
      51:in `load_missing_constant'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      06:in `const_missing'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      18:in `const_missing'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:4
      63:in `load_missing_constant'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      06:in `const_missing'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:4
      63:in `load_missing_constant'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      06:in `const_missing'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:4
      63:in `load_missing_constant'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      06:in `const_missing'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:4
      63:in `load_missing_constant'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      06:in `const_missing'
      C:/redmine-1.2.1/vendor/plugins/acts_as_attachable/lib/acts_as_attachable.rb:33:
      in `acts_as_attachable'
      C:/redmine-1.2.1/app/models/message.rb:22
      C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:53:in `gem_original
      _require'
      C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:53:in `require'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      84:in `require'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:2
      91:in `require_or_load_without_engine_additions'
      C:/redmine-1.2.1/vendor/plugins/engines/lib/engines/rails_extensions/dependencie
      s.rb:132:in `require_or_load'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:4
      51:in `load_missing_constant'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      06:in `const_missing'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
      18:in `const_missing'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/inflector.rb:364:
      in `constantize'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/inflector.rb:363:
      in `each'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/inflector.rb:363:
      in `constantize'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/core_ext/string/i
      nflections.rb:162:in `constantize'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/observer.rb:157:in
      `observed_class'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/observer.rb:183:in
      `observed_classes'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/observer.rb:166:in
      `initialize'
      C:/Ruby187/lib/ruby/1.8/singleton.rb:94:in `new'
      C:/Ruby187/lib/ruby/1.8/singleton.rb:94:in `instance'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/observer.rb:38:in `
      instantiate_observers'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/observer.rb:36:in `
      each'
      C:/redmine-1.2.1/vendor/rails/activerecord/lib/active_record/observer.rb:36:in `
      instantiate_observers'
      C:/redmine-1.2.1/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:15:
      in `define_dispatcher_callbacks'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/callbacks.rb:182:
      in `call'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/callbacks.rb:182:
      in `evaluate_method'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/callbacks.rb:166:
      in `call'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/callbacks.rb:90:i
      n `run'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/callbacks.rb:90:i
      n `each'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/callbacks.rb:90:i
      n `send'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/callbacks.rb:90:i
      n `run'
      C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/callbacks.rb:276:
      in `run_callbacks'
      C:/redmine-1.2.1/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:51:
      in `send'
      C:/redmine-1.2.1/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:51:
      in `run_prepare_callbacks'
      C:/redmine-1.2.1/config/../vendor/rails/railties/lib/initializer.rb:631:in `prep
      are_dispatcher'
      C:/redmine-1.2.1/config/../vendor/rails/railties/lib/initializer.rb:185:in `proc
      ess'
      C:/redmine-1.2.1/config/../vendor/rails/railties/lib/initializer.rb:113:in `send
      '
      C:/redmine-1.2.1/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'

C:/redmine-1.2.1/config/environment.rb:20
C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original
require'
C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
82:in `require'
C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:5
47:in `new_constants_in'
C:/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
82:in `require'
C:/redmine-1.2.1/vendor/rails/railties/lib/tasks/misc.rake:4
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_wit
h_call_chain'
C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_wit
h_call_chain'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:176:in `invoke_pre
requisites'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_pre
requisites'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:157:in `invoke_wit
h_call_chain'
C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_wit
h_call_chain'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:112:in `inv
oke_task'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top
level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `each
'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_
level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `sta
ndard_exception_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_
level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'

C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `sta
ndard_exception_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'

C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.9.2/bin/rake:32
C:/Ruby187/bin/rake:19:in `load'
C:/Ruby187/bin/rake:19
Tasks: TOP => db:migrate => environment

C:\redmine-1.2.1>

这是我的 database.yml 文件内容:

# MySQL (default setup).

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

development:
adapter: mysql
database: redmine_development
host: localhost
username: root
password:
encoding: utf8

   # 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:
      adapter: mysql
      database: redmine_test
      host: localhost
      username: root
      password:
      encoding: utf8

test_pgsql:
adapter: postgresql
database: redmine_test
host: localhost
username: postgres
password: "postgres"

test_sqlite3:
adapter: sqlite3
database: db/test.sqlite3

我真的需要一些指导。这几乎就像我的用户/密码有问题。我已将密码更改为不包含“!”或任何其他特殊字符。我确实有大写和小写字母。

任何帮助将不胜感激。

答案1

这里有两件事:

  • rake db:migrate RAILS_ENV=production确实不同,RAILS_ENV=production rake db:migrate因为前者将字符串RAILS_ENV=production作为参数传递给 rake,而后者在 shell 中声明环境变量。您应该使用然后在同一个 shell 实例(控制台)中export RAILS_ENV=production运行。rake db:migrate

  • Access denied for user 'redmine'@'localhost' (using password: YES),很明显redmine不是您 mysql 实例中的有效用户,我想您在运行脚本之前没有创建它。用于select * from mysql.user;检查该用户是否存在。

相关内容