Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.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
Postgresql psql:致命:用户“postgres”的身份验证失败_Postgresql_Ruby On Rails 4 - Fatal编程技术网

Postgresql psql:致命:用户“postgres”的身份验证失败

Postgresql psql:致命:用户“postgres”的身份验证失败,postgresql,ruby-on-rails-4,Postgresql,Ruby On Rails 4,我已经按照railcast第335集设置了Ubuntu VPS。我已经解决了一些问题,但在启动Unicorn时无法克服上面的错误。从那以后,我一直在使用这个命令进行测试,以连接到数据库 psql -U postgres -W 我编辑了/etc/postgresql/8.4/main/pg_hba.conf,如下所示 # Database administrative login by Unix domain socket local all postgres

我已经按照railcast第335集设置了Ubuntu VPS。我已经解决了一些问题,但在启动Unicorn时无法克服上面的错误。从那以后,我一直在使用这个命令进行测试,以连接到数据库

psql -U postgres -W
我编辑了/etc/postgresql/8.4/main/pg_hba.conf,如下所示

# Database administrative login by Unix domain socket
local   all         postgres                          trust   

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               trust   
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust   
# IPv6 local connections:
host    all         all         ::1/128               trust 
我使用信任、md5和密码的方法似乎并不重要,错误是相同的


任何想法都将不胜感激。

根据我的设置,请使用下面的设置可以帮助此设置亲爱的

托管所有0.0.0.0/0 md5

托管所有127.0.0.1/32 md5

主机所有::1/128 md5


尝试使用psql-U postgres-h localhost

您通常作为postgres用户连接sudo-U postgres psql。请注意,sudo会提示输入当前用户密码,除非您是root用户,而不是数据库中的用户。

看起来我在测试时使用了错误的命令,当我尝试上述方法时,一切正常。bundle exec unicorn-E production-c config/unicorn.rb现在也启动服务器。谢谢你朝着正确的方向努力。我现在从nginx得到一个502坏网关。。。继续下一个错误!