I need to access a postgresql database from a remote machine on a VPS at DigitalOcean running 12.10 and postgresql 9.1.
How do I do this? I noticed port 5432 is closed, how do I open this?
I need to access a postgresql database from a remote machine on a VPS at DigitalOcean running 12.10 and postgresql 9.1.
How do I do this? I noticed port 5432 is closed, how do I open this?
To open the port 5432 edit your
/etc/postgresql/9.1/main/postgresql.conf
and changeto
and restart your DBMS
now you can connect with
if you are unable to authentify yourself, then you need to give your user access rights to your database
Edit your
and add
(This is for a wide open access. For stricter control, consult the pg_hba.conf documentation and adjust according to your needs).
Hereafter you need also a reload
I don't need to mention that this is a basic configuration, now you should think about modify your firewall and improve the security of your DBMS.
This does not work anymore, if it ever did :
The correct possible lines for this are :
Source
For the message "server not listening", that happen to me was, that i don't erase of # on the archive postgresql.conf i mean:
to:
(Sorry for my english).
Better use local port forwarding with
ssh
:Start the port forwarding:
(Change local and foreign ports to fit your configuration).
Then you can directly connect to the database from your local computer:
Following configuration, you need to set:
In
/etc/postgresql/10/main/postgresql.conf
In
/etc/postgresql/10/main/pg_hba.conf
Restart your server:
To open your port 5432, you need to run this command