I am unable to access postgres database. RRS feed

  • Question

  • I am unable to access postgres database. I followed

    I am getting below error.

    # psql --user=XXXXX@XXXX -W
    psql: could not translate host name "" to address: Name or service not known

    Wednesday, March 6, 2019 7:29 PM

All replies

  • Hi Vigneswara,

    Can you copy the FQDN value for your PostgreSQL instance and from a cmd line, type: nslookup <value from the Azure Portal>

    This is likely a DNS issue, where either the FQDN value for your PostgrSQL instance had not replicated across DNS infrastructure or you have the incorrect instance name value for your PostgreSQL instance. 

    If you are running from a Windows host, can you type the following and retry, assuming the instance name is correct:

    ipconfig /flushdns

    I am unable to reproduce this issue, so I am thinking that this is something unique to your environment. 

    Wednesday, March 6, 2019 9:59 PM
  • If you do not white list your public IP address in the Portal, you will see the following error:

    psql: FATAL:  no pg_hba.conf entry for host "", user "miubezzi", database "postgres", SSL on
    FATAL:  SSL connection is required. Please specify SSL options and retry.

    Once my public IP was added, I had no issues connecting:

    Wednesday, March 6, 2019 10:14 PM
  • And please try with the following psql command, replacing <Instance_Name> and <Server_Admin_Login> values with the correct actual value:

    psql --host=<Instance_Name> --port=5432 --username=<Server_Admin_Login>@<Instance_Name> --dbname=postgres

    You will be prompted to enter the <Server_Admin_Login> password in interactive mode.

    Wednesday, March 6, 2019 10:20 PM
  • I use "PGPASSWORD=<password> psql -h <host> -U <user> -d postgres" and it works fine.

    The database should be also included. By default it is call 'postgres'.

    Please post more info, if the issue still exists.

    <style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} </style>

    Wednesday, March 6, 2019 10:42 PM