Cant access database from pgAdmin

0

I`m using postgresql database on my web server (ubuntu + nginx) and it works with backend app. I want to connect remotely using pgAdmin but it always throw this error:

could not connect to server: Connection timed out(0x0000274C/10060)
Is the server running on host "ip" and accepting
TCP/IP connections on port 5432?

connection error

I already add to my pg_hba.conf this line:

host all all all password

and also add to postgresql.conf line:

listen_addresses = '*'

netstat -nlt does next result, and it`s enough in tutuorials i found, but still cant access my database

netstat

postgresql
nginx
asked on Stack Overflow Feb 13, 2020 by Mateech • edited Feb 14, 2020 by Mateech

2 Answers

1

Found a solution, it works as well after this command:

sudo ufw allow 5432/tcp
answered on Stack Overflow Feb 13, 2020 by Mateech • edited Feb 14, 2020 by a_horse_with_no_name
0

Open file named pg_hba.conf

sudo vi pg_hba.conf

and add this line to that file

host  all  all 0.0.0.0/0 md5

It allows access to all databases for all users with an encrypted password

restart your server

sudo /etc/init.d/postgresql restart
answered on Stack Overflow Feb 13, 2020 by Arpit Jain

User contributions licensed under CC BY-SA 3.0