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: Peer authentication failed というエラーの解決方法

Last updated at Posted at 2021-11-16

次のようにユーザーがある状態でエラーが出る時の対策です。

postgres=# select usename from pg_user;
 usename  
----------
 postgres
 scott
(2 rows)

エラーの状況

$ psql -U scott city
psql: error: FATAL:  Peer authentication failed for user "scott"

pg_hba.conf を編集します。

/etc/postgresql/14/main/pg_hba.conf
(省略)
#local   all             all     peer
local   all             all     trust
(省略)

PostgreSQL を再起動

sudo systemctl restart postgresql

問題が解決したことを確認

$ psql -U scott city
psql (14.11 (Ubuntu 14.11-0ubuntu0.22.04.1))
Type "help" for help.

city=> 
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?