none
I am unable to access postgres database. RRS feed

  • Question

  • I am unable to access postgres database. I followed https://docs.microsoft.com/en-us/azure/postgresql/quickstart-create-server-database-portal

    I am getting below error.

    # psql --host=XXXXXXXXX.XXXXXXX.database.azure.com --user=XXXXX@XXXX -W
    Password:
    psql: could not translate host name "XXXXXXXXX.XXXXXXX.database.azure.com" 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
    Moderator
  • 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 "96.89.144.107", 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
    Moderator
  • 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>.postgres.database.azure.com --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
    Moderator
  • 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