pgAdmin4无法连接到本地pgsql

问题描述 投票:0回答:1

操作系统:Manjaro Gnome 错误:

Unable to connect to server:

connection failed: Connection refused
    Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Address not available
    Is the server running on that host and accepting TCP/IP connections?

我正在 docker 上运行 pgadmin4 镜像,用 pacman 安装了 pgsql 防火墙状态为:

Status: active

To                         Action      From
--                         ------      ----
5432/tcp                   ALLOW       Anywhere                  
5432/tcp (v6)              ALLOW       Anywhere (v6)

pgadmin4 on Docker

配置: postgresql.conf

local   all             all                                     md5
# 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     all                                     md5
host    replication     all             127.0.0.1/32            md5
host    replication     all             ::1/128                 md5
#custom
host    all             all             0.0.0.0/0               md5

pg_hba.conf

# - Connection Settings -

listen_addresses = '*'      # what IP address(es) to listen on;
                    # comma-separated list of addresses;
                    # defaults to 'localhost'; use '*' for all
                    # (change requires restart)
#port = 5432                # (change requires restart)
max_connections = 100           # (change requires restart)

.zshrc 我该怎么办?

postgresql pgadmin manjaro
1个回答
0
投票

解决方案: 好吧🤣它是在我之后措辞的 将 pgadmin4 配置“主机”设置为 '192.168.0.105' 这是我的“主机 IP 地址”。

因为我没有开始docker学习,请注意,我们不能直接连接到localhost,而是访问'主机ip地址'。

肯定有效。感谢chatgpt。 Docker和linux的学习真的很重要!

© www.soinside.com 2019 - 2024. All rights reserved.