title: psql: could not connect to server... Is the server running on host ... and accepting TCP/IP connections on port 5432?
body: <p>I know this is a popular question.  I have tried everything suggested in similar <a href="https://stackoverflow.com/questions/38466190/cant-connect-to-postgresql-on-port-5432">threads</a>.   I am trying to connect remotely to a postgresql database on an azure windows server 2012 machine.   I have tried the following...</p>
  
  <p><strong>postgresql.conf</strong> </p>
  
  <pre><code>listen_addresses = '*'
  </code></pre>
  
  <p><strong>pg_hba.conf</strong></p>
  
  <pre><code># IPv4 local connections:
  host    all             all             0.0.0.0/0            md5
  </code></pre>
  
  <p><strong>Firewall</strong></p>
  
  <blockquote>
    <p>New inbound rule (firewall) protocols and ports > protocol type > TCP</p>
    
    <p>Local port > 5432 Remote port > All</p>
  </blockquote>
  
  <p><strong>Grab IP of remote machine</strong></p>
  
  <p>I copied from azure dashboard and also as indicated on top of remote desktop connection</p>
  
  <p><a href="https://i.stack.imgur.com/S9QVS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S9QVS.png" alt="enter image description here"></a></p>
  
  <p><strong>CMD from local machine</strong></p>
  
  <p>Then from local machine tried the following.</p>
  
  <pre><code>psql -U postgres -h 13.xx.xx.xx 
  </code></pre>
  
  <p><strong>Error message.</strong></p>
  
  <blockquote>
    <p>psql: could not connect to server: Connection timed out
    (0x0000274C/10060)
            Is the server running on host "13.xx.xx.xx" and accepting
            TCP/IP connections on port 5432?</p>
  </blockquote>
  
  <p>I am not sure what else should be done.</p>