Cannot connect to postgres from remote host

前端 未结 6 1277
刺人心
刺人心 2020-12-13 12:50

I have a database server (192.168.1.50) running postgres. I have created a database named \"testdb\" and a user \"testuser\" with password \"testuserpw\".
Locally, I can

6条回答
  •  北海茫月
    2020-12-13 13:22

    On Ubuntu, I noticed that remote access at some point stopped working (currently using 9.1.9). The reason is, that postgres is no longer started with the -i switch [1] so no matter what you configure for listen_addresses, it will be ignored.

    Fortunately, adding the following line to /etc/environment solves the problem after logging out and in again (or reboot):

    PGOPTIONS="-i"
    

    See [2] for more options. Note, that adding this to /etc/postgresql/9.1/main/environment did NOT work for me.

    Now, when doing nmap ip-of-my-remote-server I finally get this again:

    5432/tcp open  postgresql
    

    Yay!

    [1] http://www.postgresql.org/docs/9.1/static/runtime-config-short.html

    [2] http://www.postgresql.org/docs/9.1/static/libpq-envars.html

提交回复
热议问题