pgAdmin4 can't connect to local pgsql

60 views Asked by At

OS: Manjaro Gnome Error:

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?

i am running pgadmin4 image on docker,installed pgsql with pacman firewall status are:

Status: active

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

pgadmin4 on Docker

Configration: 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 what should i do?

1

There are 1 answers

0
fromKansascity On

solution: well it worded after i set pgadmin4 config 'host' to '192.168.0.105' which is my ‘ host IP address‘.

for i didn't start docker learning ,notice that,we can't connect to localhost directly but access 'host ip address'.

sure that worked. thanks to chatgpt. Docker and linux learning is really important!