現象
以下のメッセージが表示される
error: 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"?
対策
PostgreSQLサーバ上の既存アカウントにて以下のコマンドを実行し、サーバを起動する
pg_ctlcluster 12 main start
PostgreSQLインストール時、以下のメッセージが表示されている場合、本対策で対応可能です。
Success. You can now start the database server using: pg_ctlcluster 12 main start
要するに、インストール時のメッセージをしっかり読みなさい、ということでした。。。
PostgreSQLインストール方法について参考にしたサイト