耙子流产了! PG :: ConnectionBad:fe_sendauth:没有密码提供sinatra

时间:2015-09-21 04:19:48

标签: ruby postgresql sinatra sinatra-activerecord

我似乎无法让这个工作。我在运行bundle exec rake db:migrate后尝试运行bundle exec rake db:create,它给了我这个错误:

rake aborted! PG::ConnectionBad: fe_sendauth: no password supplied /home/david/DBC/survey-gorilla-challenge/Rakefile:106:in block (2 levels) in <top (required)>' Tasks: TOP => db:migrate (See full trace by running task with --trace)

我试过环顾四周,但这似乎都是铁轨的解决方案,而我正在使用Sinatra和activerecord。我不确定这是否有所不同。我甚至尝试更改我的pg_hba.conf,目前看起来像这样:

IPv4 local connections: host all all 127.0.0.1/32 md5 IPv6 local connections: host all all ::1/128 md5

我不确定如何让这个工作。任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:1)

我解决了。我将pg_hba.conf更改为

TYPE  DATABASE        USER            ADDRESS                 METHOD

"local" is for Unix domain socket connections only

host   all             all          127.0.0.1/32               trust
 IPv4 local connections:
host   all             PC           127.0.0.1/32               trust
 IPv6 local connections:
host   all             all            ::1/128                  trust

然后使用sudo nano /etc/postgresql/9.3/main/pg_hba.conf重新启动postgres。这样就可以进行迁移。