0
votes

I try do access remotely a Postgresql(10.3) db.

After I modify #listen_addresses = 'localhost' to listen_addresses = '*' or the ip, I get an error when I use:

sudo -u postgres psql

'Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? '

1
edit pg_hba.conf and give proper access rule for database, role and the IP of your remote locationDaniel Faure

1 Answers

1
votes

simply remove '#' - before - that means commented line.

UPDATE: if you changed postgresql's listen configuration, then default socket connection is not present. So if you specify exact IP for listen: listen_address = '192.168.1.2' then you need to connect via psql -h 192.168.1.2 -U postgres and your pg_hba.conf should contain entry similar to :

host    all             all             192.168.1.2/32            md5

and you will need to know postgres password. if you not worried about security - then simply use

host    all             all             192.168.1.2/32            trust

WARNING: do not use 'trust' configuration in production!