耙中止! PG::ConnectionBad: fe_sendauth: 没有提供密码 sinatra

rake aborted! PG::ConnectionBad: fe_sendauth: no password supplied sinatra

我似乎无法让它工作。我尝试 运行 bundle exec rake db:migrate 在 运行ning 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)

我试过环顾四周,但这一切似乎都是 rails 的解决方案,而我将其与 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

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

我解决了。我将 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。这使迁移继续进行。