0

I have setup Rail application in my local server. And I am using Postgresql database.

But it creates error :

Error message: FATAL: Ident authentication failed for user "nobody" (PG::Error)

Exception class: PhusionPassenger::UnknownError

Backtrace:

File    Line    Location
0   /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb     1208    in `initialize'
1   /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb     1208    in `new'
2   /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb     1208    in `connect'
3   /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb     326     in `initialize'
4   /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb     28  in `new'
5   /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb     28  in `postgresql_connection'
6   /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb   315     in `new_connection'
7   /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb   325     in `checkout_new_connection'
8   /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb   247     in `block (2 levels) in checkout'
9   /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb   242     in `loop'
10  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb   242     in `block in checkout'
11  /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb     211     in `mon_synchronize'
12  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb   239     in `checkout'
13  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb   102     in `block in connection'
14  /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb     211     in `mon_synchronize'
15  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb   101     in `connection'
16  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb   410     in `retrieve_connection'
17  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb  171     in `retrieve_connection'
18  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb  145     in `connection'
19  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/sanitization.rb   130     in `replace_bind_variables'
20  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/sanitization.rb   117     in `sanitize_sql_array'
21  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/sanitization.rb   28  in `sanitize_sql_for_conditions'
22  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/relation/query_methods.rb     324     in `build_where'
23  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/relation/query_methods.rb     136     in `where'
24  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activerecord-3.2.11/lib/active_record/querying.rb   9   in `where'
25  /var/www/PCMI/zil/app/models/order.rb   8   in `'
26  /var/www/PCMI/zil/app/models/order.rb   1   in `'
27  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activesupport-3.2.11/lib/active_support/dependencies.rb     251     in `require'
28  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activesupport-3.2.11/lib/active_support/dependencies.rb     251     in `block in require'
29  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activesupport-3.2.11/lib/active_support/dependencies.rb     236     in `load_dependency'
30  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activesupport-3.2.11/lib/active_support/dependencies.rb     251     in `require'
31  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activesupport-3.2.11/lib/active_support/dependencies.rb     359     in `require_or_load'
32  /usr/local/rvm/gems/ruby-1.9.3-p125@openmunicipalities.org/gems/activesupport-3.2.11/lib/active_support/dependencies.rb     313     in `depend_on'
33  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/activesupport-3.2.11/lib/active_support/dependencies.rb     225     in `require_dependency'
34  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/railties-3.2.11/lib/rails/engine.rb     439     in `block (2 levels) in eager_load!'
35  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/railties-3.2.11/lib/rails/engine.rb     438     in `each'
36  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/railties-3.2.11/lib/rails/engine.rb     438     in `block in eager_load!'
37  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/railties-3.2.11/lib/rails/engine.rb     436     in `each'
38  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/railties-3.2.11/lib/rails/engine.rb     436     in `eager_load!'
39  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/railties-3.2.11/lib/rails/application/finisher.rb   53  in `block in '
40  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/railties-3.2.11/lib/rails/initializable.rb  30  in `instance_exec'
41  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/railties-3.2.11/lib/rails/initializable.rb  30  in `run'
42  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/railties-3.2.11/lib/rails/initializable.rb  55  in `block in run_initializers'
43  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/railties-3.2.11/lib/rails/initializable.rb  54  in `each'
44  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/railties-3.2.11/lib/rails/initializable.rb  54  in `run_initializers'
45  /usr/local/rvm/gems/ruby-1.9.3-p125@odomain/gems/railties-3.2.11/lib/rails/application.rb   136     in `initialize!'
46  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/railties-3.2.11/lib/rails/railtie/configurable.rb   30  in `method_missing'
47  /var/www/PCMI/zil/config/environment.rb     5   in `'
48  config.ru   3   in `require'
49  config.ru   3   in `block in '
50  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/rack-1.4.5/lib/rack/builder.rb  51  in `instance_eval'
51  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/rack-1.4.5/lib/rack/builder.rb  51  in `initialize'
52  config.ru   1   in `new'
53  config.ru   1   in `'
54  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb  225     in `eval'
55  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb  225     in `load_rack_app'
56  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb  157     in `block in initialize_server'
57  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/utils.rb     563     in `report_app_init_status'
58  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb  154     in `initialize_server'
59  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb   204     in `start_synchronously'
60  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb   180     in `start'
61  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb  129     in `start'
62  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb     253     in `block (2 levels) in spawn_rack_application'
63  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb    132     in `lookup_or_add'
64  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb     246     in `block in spawn_rack_application'
65  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb    82  in `block in synchronize'
66  < td=""> <> prelude>    10:in `synchronize'
67  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb    79  in `synchronize'
68  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb     244     in `spawn_rack_application'
69  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb     137     in `spawn_application'
70  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb     275     in `handle_spawn_application'
71  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb   357     in `server_main_loop'
72  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb   206     in `start_synchronously'
73  /usr/local/rvm/gems/ruby-1.9.3-p125@domain/gems/passenger-3.0.17/helper-scripts/passenger-spawn-server

config/database.yml

development:

  adapter: postgresql
  encoding: utf8
  database: PCMI
  pool: 5
  username: postgres
  password: postgres


test: &TEST

  adapter: postgresql
  encoding: utf8
  database: PCMI 
  pool: 5
  username: postgres
  password: postgres

production:

  adapter: postgresql
  encoding: utf8
  database: PCMI
  pool: 5
  username: postgres
  password: postgres

Please help me for solve this error..

If you need any further information regarding these error then plz inform.

Thank you.

4

1 回答 1

1

PostgreSQL 有两种认证方式。一种是通过 Unix 套接字身份验证,这意味着 PostgreSQL 会检查连接到 PostgreSQL 的进程的用户,然后检查该用户是否有权访问数据库。这种认证方式是你在命令行通过pg命令访问PostgreSQL时通常使用的方式。

第二个是您已经熟悉的基于密码的身份验证。

看起来您没有为“postgres”用户正确设置密码身份验证。最重要的是,您的应用程序以“nobody”用户身份运行,因此 PostgreSQL 无法通过 Unix 套接字对您的应用程序进行身份验证。

解决方案是创建一个 PostgreSQL 用户名/密码身份验证条目,并将其填充到您的 database.yml 中。

于 2013-05-06T09:45:39.500 回答