Score:1

unable to connect to server: connection failed: connection refused is the server running on that host accepting tcp/ip connections?

in flag

I have postgres 13.10 and PGAdmin4 7.1 installed on Ubuntu 22.04

In PGAdmin4 UI, I want to "add new server" with these configurations

name
postgres-local

username
postgres

pw
postgres

hostanme / address
127.0.0.1

port
5432

server group
Servers

so I have run in my terminal

sudo -i -u postgres

psql


ALTER USER postgres WITH PASSWORD 'postgres';

Then I login into PGAdmin4, try to add new server inserting the cofigurations above, but as I click on save I get this error

unable to connect to server: connection failed: connection refused is the server running on that host accepting tcp/ip connections?

What could be the problem?

What I already tried

I have checked that postgres is running correctly via sudo service postgresql status.

enter image description here

I have already tryed to

edit file /etc/postgresql/13/main/postgresql.conf uncommenting
listen_addresses = 'localhost'
and changing it into
listen_addresses = '*'

edit file /etc/postgresql/13/main/pg_hba.conf changing lines

# IPv4 local connections:
host    all             all             127.0.0.1/32               md5

to

# IPv4 local connections:
host    all             all             0.0.0.0/0               md5

restarting postgres

sudo service postgresql restart

But I had no success.

Score:1
gr flag

Have you made sure that postgres is running on that port?

sudo netstat -lntp | grep postgres

Have you made sure that the firewall is not blocking that port?

sudo ufw allow 5432
Tms91 avatar
in flag
Actually by running `sudo netstat -lntp | grep postgres` I found out postgres was runnng under port 5433. I was going to uninstall and reinstall all. Thanks!!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.