Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何解决Ruby pg中的身份验证错误_Ruby On Rails_Ruby_Postgresql - Fatal编程技术网

Ruby on rails 如何解决Ruby pg中的身份验证错误

Ruby on rails 如何解决Ruby pg中的身份验证错误,ruby-on-rails,ruby,postgresql,Ruby On Rails,Ruby,Postgresql,我在本地服务器上安装了rails应用程序。 成功rake db:create和rake db:migrate。 database.yml development: adapter: postgresql encoding: unicode database: app_development pool: 5 username: user password: passwd test: adapter: postgresql encoding: unicode

我在本地服务器上安装了rails应用程序。
成功rake db:create和rake db:migrate。

database.yml

development:
  adapter: postgresql
  encoding: unicode
  database: app_development
  pool: 5
  username: user
  password: passwd

test:
  adapter: postgresql
  encoding: unicode
  database: app_test
  pool: 5
  username: user
  password: passwd

production:
  adapter: postgresql
  encoding: unicode
  database: app_production
  pool: 5<
  username: user
  password: passwd
错误

还修改了pg_hba.conf,但显示了相同的错误

/var/lib/pgsql/9.3/data/pg_hba.conf

# "local" is for Unix domain socket connections only
local   all             all                                     trust

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
用户在ruby和setup中创建数据库的方法是相同的

另一个没有发现问题 请帮助我:(

ruby 2.0.0p247(2013-06-27修订版41674)[x86_64-linux]

CentOS 6.4版(最终版)

psql(PostgreSQL)9.3.1


你也可以发布你的database.yml?你有没有尝试过
rails c
我可以“rails c”并查看表中的内容。有趣的是,当你能够在没有错误的情况下执行
rails c
时,你连接没有错误:)似乎有误解。运行
rails s
并连接到localhost:3000时是否出现错误?现在很晚了,但我能够连接 :)
initialize': FATAL:  Ident authentication failed for user "user"(PG::ConnectionBad)
# "local" is for Unix domain socket connections only
local   all             all                                     trust

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust