title: no pg_hba.conf entry for host / Connect call failed / Invalid data directory for cluster 12 main - Postgresql Ubuntu
body: <p>I'm trying to move my bot to an Ubuntu virtual server from Vultr but it's having a problem connecting to the postgres database. I've tried editing the config from md5 to true, and host to local, etc. But those only give me different errors and also make it stop working on my original machine too. It's working perfectly fine on my Windows machine. Here is the error I'm facing:</p>
  <pre><code>asyncpg.exceptions.InvalidAuthorizationSpecificationError: no pg_hba.conf entry for host &quot;[local]&quot;, user &quot;postgres&quot;, database &quot;xxx&quot;, SSL off
  </code></pre>
  <p>So I've tried to change this line:</p>
  <pre><code>async def create_db_pool():
      bot.pg_con = await asyncpg.create_pool(database='xxx', user='postgres', password='???')
  </code></pre>
  <p>to this:</p>
  <pre><code>async def create_db_pool():
      bot.pg_con = await asyncpg.create_pool(database='xxx', user='postgres', password='???', ssl=True)
  </code></pre>
  <p>and that gives me this error:</p>
  <pre><code>asyncpg.exceptions._base.InterfaceError: `ssl` parameter can only be enabled for TCP addresses, got a UNIX socket path: '/run/postgresql/.s.PGSQL.5432'
  </code></pre>
  <p>So I don't know what else to try. I've been stuck on this for a while. If it's relevant, it connects at the bottom of the bot.py file like this:</p>
  <pre><code>bot.loop.run_until_complete(create_db_pool())
  </code></pre>
  <p>Whether ssl is True or not, the database seems to still function on my Windows machine. But I can't get it to work on my Ubuntu virtual server.</p>
  <p>If I edit my config to this:</p>
  <pre><code># TYPE  DATABASE        USER            ADDRESS                 METHOD
  
  # IPv4 local connections:
  host    all             all             0.0.0.0/0            md5
  # IPv6 local connections:
  host    all             all             ::/0                 md5
  # Allow replication connections from localhost, by a user with the
  # replication privilege.
  host    replication     all             0.0.0.0/0            md5
  host    replication     all             ::/0                 md5
  </code></pre>
  <p>Then I get a call error like this:</p>
  <pre><code>OSError: Multiple exceptions: [Errno 111] Connect call failed ('::1', 5432, 0, 0), [Errno 111] Connect call failed ('127.0.0.1', 5432)
  </code></pre>
  <p>This is really driving me crazy. I have no idea what to do. I bought this virtual server to host my bot on but I can't even get it to connect to the database.</p>
  <p>When I simply type <code>psql</code> in the terminal, I get this error:</p>
  <pre><code>Error: Invalid data directory for cluster 12 main
  </code></pre>
  <p>Postgres is not working as intended in basically any way. I'm using Vultr.com to host the Ubuntu server, if that matters. And connecting with PuTTy.</p>