【发布时间】:2024-05-03 18:25:03
【问题描述】:
我关注了this tutorial。
我设法设置了所有内容,并完全按照教程中的说明进行操作。
但是当我尝试使用 PGADMIN 4 连接到它时,我得到了连接时间并且我永远无法修复它。
然后我找到this link,里面有如下命令:
sudo -i -u postgres
psql
\conninfo
然后我可以看到以下消息:
You are connected to database "postgres" as user "postgres" via socket in "/var/run/postgresql" at port "5432".
所以我现在不明白什么是错的,当我输入时:
sudo nano ../../etc/postgresql/9.3/main/pg_hba.conf
查看文件的内容并输入密码,密码不被接受。
然后我通过关闭窗口重新启动一切并再次打开它,然后我可以查看文件:
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
# IPv4 remote connections for the tutorial:
#host all all 127.0.0.1/32 md5
#host all all 35.196.55.208/32 md5
host all all all md5
我添加了最后 4 行来解决问题,但还没有。
我做错了什么?我正在查看许多教程,以及 Stack Overflow 的几页,但仍然没有!
【问题讨论】:
标签: postgresql ubuntu google-cloud-platform pgadmin-4