title: Error: connection to server on socket "/tmp/.s.PGSQL.5432" failed
body: <p>I'm kind of hitting my head against the wall trying to figure this out...</p>
  <p>When I run <code>psql</code> in my terminal, it gives me:</p>
  <pre><code>psql: error: connection to server on socket &quot;/tmp/.s.PGSQL.5432&quot; failed: Connection refused
          Is the server running locally and accepting connections on that socket?
  </code></pre>
  <p>I see the service running with <code>brew services</code>, but another one appears because I tried to upgrade PSQL as well, but that might've messed it up even more.</p>
  <pre><code>postgresql        started fella /Users/fella/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
  postgresql@13     stopped 
  </code></pre>
  <p>I've tried:</p>
  <ul>
  <li><code>pg_ctl -D /usr/local/var/postgres stop -s -m fast</code></li>
  <li>output &gt;&gt; <code>pg_ctl: PID file &quot;/usr/local/var/postgres/postmaster.pid&quot; does not exist Is server running?</code></li>
  <li><code>pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start</code></li>
  <li>output &gt;&gt; <code>waiting for server to start.... stopped waiting pg_ctl: could not start server Examine the log output.</code></li>
  </ul>
  <p>I tried:</p>
  <ul>
  <li>brew update</li>
  <li>brew upgrade</li>
  </ul>
  <p>which went without any errors, but I still get the same error when I run psql</p>
  <p>I just ran</p>
  <p><code>➜  ~ code /usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist</code></p>
  <p><code>➜  ~ tail -n 100 /usr/local/var/log/postgres.log</code></p>
  <p>And found a whole bunch of errors there. Lots of this happening:</p>
  <blockquote>
  <pre><code>incompatible with server 2021-10-24 18:04:41.848 MDT [1038] DETAIL: 
  The data directory was initialized by PostgreSQL version 13, which is
  not compatible with this version 14.0.
  </code></pre>
  </blockquote>
  <p>But this was the most recent one:</p>
  <blockquote>
  <p>2021-10-24 18:09:45.680 MDT [4129] LOG:  starting PostgreSQL 14.0
  on x86_64-apple-darwin20.6.0, compiled by Apple clang version 13.0.0</p>
  <p>(clang-1300.0.29.3), 64-bit 2021-10-24 18:09:45.682 MDT [4129] LOG:
  listening on IPv6 address &quot;::1&quot;, port 5432 2021-10-24 18:09:45.682 MDT</p>
  <p>[4129] LOG:  listening on IPv4 address &quot;127.0.0.1&quot;, port 5432</p>
  <p>2021-10-24 18:09:45.763 MDT [4129] LOG:  listening on Unix socket</p>
  <p>&quot;/tmp/.s.PGSQL.5432&quot; 2021-10-24 18:09:45.814 MDT [4129] LOG:  could
  not open directory &quot;pg_tblspc&quot;: No such file or directory 2021-10-24</p>
  <p>18:09:45.815 MDT [4129] LOG:  could not open configuration file</p>
  <p>&quot;/usr/local/var/postgres/pg_hba.conf&quot;: No such file or directory</p>
  <p>2021-10-24 18:09:45.816 MDT [4129] FATAL:  could not load pg_hba.conf</p>
  <p>2021-10-24 18:09:45.818 MDT [4129] LOG:  database system is shut down</p>
  <p>postgres: could not access the server configuration file</p>
  <p>&quot;/usr/local/var/postgres/postgresql.conf&quot;: No such file or directory</p>
  <p>postgres: could not access the server configuration file</p>
  <p>&quot;/usr/local/var/postgres/postgresql.conf&quot;: No such file or directory</p>
  <p>postgres: could not access the server configuration file</p>
  <p>&quot;/usr/local/var/postgres/postgresql.conf&quot;: No such file or
  directory</p>
  </blockquote>