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