title: Travis-CI and PostgreSQL: psql: error: could not connect to server: No such file or directory
body: <p>I'm trying to get a PostgreSQL 12 Database for my Travis-CI build. I've been trying for hours. I've looked at the other threads on Travis-CI Community and on StackOverFlow. But I've made no progress and it keeps failing.</p>
  <p>I'm using <code>dist: focal</code> so it has PostgreSQL 12.2. So I don't need to mess with <code>addons: postgres: '12'</code> and <code>apt: ...</code><br />
  The <code>psql --version</code> command works, but the <code>psql -c 'create database ...</code> command does not.</p>
  <p>If I remove the <code>psql -c 'create database ...</code> command, my application fails to start due to the missing Database, with</p>
  <pre><code>Caused by: org.postgresql.util.PSQLException at ConnectionFactoryImpl.java:303
  Caused by: java.net.ConnectException at Net.java:-2
  </code></pre>
  <p>Yes, I've read the Travis <a href="https://docs.travis-ci.com/user/database-setup/#postgresql" rel="nofollow noreferrer">Database Setup</a> Documentation.<br />
  The link to the Travis build is: <a href="https://travis-ci.com/github/lukegjpotter/pokemon-team-building-tools/jobs/480144598" rel="nofollow noreferrer">lukegjpotter/pokemon-team-building-tools/jobs/480144598</a>.<br />
  Please Help.</p>
  <p>The relevant lines in my travis.yml file is as follows:</p>
  <pre><code>language: java
  os: linux
  dist: focal
  jdk:  oraclejdk13
  services:
    - postgresql
  before_script:
    - cp config/database.yml.travis config/database.yml
    - psql --version
    - psql -c 'create database travis_ci_test;' -U postgres
  env: DATABASE_URL=postgres://postgres:@localhost:5432/travis_ci_test
  </code></pre>
  <p>The relevant lines in my build output is as follows:</p>
  <pre><code>$ psql --version
  psql (PostgreSQL) 12.5 (Ubuntu 12.5-0ubuntu0.20.04.1)
  
  $ psql -c 'create database travis_ci_test;' -U postgres
  psql: error: could not connect to server: No such file or directory
  Is the server running locally and accepting
  connections on Unix domain socket &quot;/var/run/postgresql/.s.PGSQL.5432&quot;?
  The command &quot;psql -c 'create database travis_ci_test;' -U postgres&quot; failed and exited with 2 during .
  </code></pre>
  <p>Regards,
  Luke</p>