首页 > 解决方案 > pgadmin4 无法连接到服务器,致命:用户“postgres”的密码验证失败

问题描述

我尝试将 postgresql 配置为能够“远程”连接到 pgadmin4 所以我在服务器中安装了 postgresql 版本 13,并尝试通过我的笔记本电脑访问它。

但是为什么我总是报错,我刚改了密码,在pgadmin4中输入了用户名和密码,它仍然说密码验证。

图像1

这是我的 pghba.conf 文件。

# TYPE  DATABASE        USER            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
host    all             all             0.0.0.0/0           trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust

这是我的 postgesql.conf 文件

listen_addresses = '*'
                    # comma-separated list of addresses;
                    # defaults to 'localhost'; use '*' for all
                    # (change requires restart)
port = 5434             # (change requires restart)
max_connections = 100           # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directories = '/var/run/postgresql, /tmp'  # comma-separated list of directories
                    # (change requires restart)
#unix_socket_group = ''         # (change requires restart)
#unix_socket_permissions = 0777     # begin with 0 to use octal notation
                    # (change requires restart)
#bonjour = off              # advertise server via Bonjour
                    # (change requires restart)
#bonjour_name = ''          # defaults to the computer name
                    # (change requires restart)

# - TCP settings -
# see "man tcp" for details

#tcp_keepalives_idle = 0        # TCP_KEEPIDLE, in seconds;
                    # 0 selects the system default
#tcp_keepalives_interval = 0        # TCP_KEEPINTVL, in seconds;
                    # 0 selects the system default
#tcp_keepalives_count = 0       # TCP_KEEPCNT;
                    # 0 selects the system default
#tcp_user_timeout = 0           # TCP_USER_TIMEOUT, in milliseconds;
                    # 0 selects the system default

# - Authentication -

#authentication_timeout = 1min      # 1s-600s
password_encryption = scram-sha-256     # md5 or scram-sha-256
#db_user_namespace = off

# GSSAPI using Kerberos
#krb_server_keyfile = 'FILE:${sysconfdir}/krb5.keytab'
#krb_caseins_users = off

我仍然不知道为什么,也许有人经历过同样的事情?或者有什么想法?仅供参考:我打开 pgadmin4 应用程序和 url 去这个:http: //127.0.0.1 :60888/browser/

这是我在浏览器中的 pgadmin4

标签: postgresqlpgadminpgadmin-4

解决方案


在 image1 上,您更改了 Postgres linux 用户的密码,而不是 Postgres 数据库用户的密码。接下来试试:

sudo -u postgres psql postgres # connect to Postgres
\password postgres # change password postgres user
\q # quite from Postgres shell

然后尝试再次连接到 Postgres。

会有所帮助:https ://docs.boundlessgeo.com/suite/1.1.1/dataadmin/pgGettingStarted/firstconnect.html


推荐阅读