0
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 3 years have passed since last update.

Python3: psycopg2 のエラー対策

Posted at

PostgreSQL に接続するライブラリーの psycopg2 を使っていてエラーが出た時の対策です。
Ubuntu 21.10 での対策です。

エラーメッセージ

FATAL:  Peer authentication failed for user

次のファイルを編集します。

変更前

/etc/postgresql/12/main/pg_hba.conf
(省略)
local   all             all                                     peer

変更後

/etc/postgresql/12/main/pg_hba.conf
(省略)
local   all             all                                     trust

PostgreSQL の再起動

sudo systemctl restart postgresql
0
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
0
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?