title: PostgreSQL error: could not connect to database template1: could not connect to server: No such file or directory
body: <p>I need to create database.</p>
  
  <p>First I run: <code>sudo su - postgres</code>, then: <code>createdb test</code></p>
  
  <p>And I keep getting this error: </p>
  
  <pre><code>createdb: could not connect to database template1: could not connect to server: No such file or directory
      Is the server running locally and accepting
      connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"
  </code></pre>
  
  <p>This is unexpected, I have never encountered any problems with psql, but this time I don't get what is wrong. And there is no external server, I am connected locally.</p>
  
  <p>I am running on Ubuntu.</p>