1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[ポカミス]postgresqlで'error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed'が出た

Posted at

TL;DR

pg_hba.conf内でスペルミスをしていた。アレ?と思ったらログを見ようと思った(当たり前)。

何があった?

Ubuntu22.04に入れたpostgresqlに接続しようとしたところ、以下のようなエラーに遭遇した。

psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?

systemctl status postgresqlとしてもちゃんと動いているので「?」と思ったが、/var/log/postgresqlの中にあったログファイルを見ると、最後5行が以下で、「あ~これやん」となった。

2022-07-17 22:10:57.919 JST [7287] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-07-17 22:10:57.942 JST [7287] LOG:  invalid authentication method "cram-sha-256"
2022-07-17 22:10:57.942 JST [7287] CONTEXT:  line 106 of configuration file "/etc/postgresql/14/main/pg_hba.conf"
2022-07-17 22:10:57.942 JST [7287] FATAL:  could not load pg_hba.conf
2022-07-17 22:10:57.943 JST [7287] LOG:  database system is shut down
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?