为什么我不能连接到我的PostgreSQL数据库?

我试图安装帐篷pipe理员 。

在此步骤中安装失败:

$ DATABASE_URL=postgres://localhost/tent_server bundle exec rake db:migrate 

我也试过这个:

 $ DATABASE_URL=postgres://tent:tent@localhost/tent_server bundle exec rake db:migrate 

我得到的错误信息是:

 Error: Sequel::DatabaseConnectionError: PG::Error: FATAL: Ident authentication failed for user "tent" /usr/local/rvm/gems/ruby-1.9.3-p392/gems/sequel-3.43.0/lib/sequel/adapters/postgres.rb:208:in `initialize' 

我的Postgres安装如下所示:

 $ cat ~/.pgpass localhost:5432:tent_server:tent:tent postgres=# CREATE USER tent WITH password 'tent'; CREATE ROLE postgres=# CREATE DATABASE tent_server with OWNER tent; CREATE DATABASE 

问题

FATAL: Ident authentication failed for user "tent"
Postgres正在尝试使用identvalidation,并没有按预期工作。

  1. 阅读Postgres手册,特别是关于pg_hba.conf 的部分和关于identauthentication的部分 。
  2. 以下任何一项
    • 实现identvalidation不是你想要的,并configuration更合适的东西 。
    • 修复你的ident用户映射和/或你的identd守护进程,以便像Postgres期望的那样工作。

build议

identvalidation是非常糟糕的(这是基于客户端的安全性,说谎你是谁是微不足道的攻击者)。
configuration其他许多authentication方法之一(具有实际的安全性)。

或者,如果您愿意,使用trust身份validation连接到本地(unix)套接字(但请注意,这具有自己的安全隐患)。