我最近在 linux red hat 上安裝了 Postgre 版本 10。我正在嘗試配置 psql 在訪問資料庫時會提示用戶輸入密碼。將所有內容更改為 scram-sha-256 后。訪問 psql 時出現此錯誤
psql: FATAL: password authentication failed for user "postgres"
這是我的 pg_hba.conf:

知道如何解決這個問題嗎?謝謝!
uj5u.com熱心網友回復:
Postgres 默認存盤密碼md5格式。如果要更改密碼加密,則必須遵循以下解決方案:
PS:在開始之前,您必須撤消pg_hba.conf檔案身份驗證方法以md5
- 編輯
postgresql.conf并更改password_encryption為
password_encryption = scram-sha-256
重啟 Postgres 服務(或重新加載服務)
重置用戶密碼
# if use psql cli
\password <user>
# If use SQL command
alter user <user> with password '<password>';
- 更新所有密碼后,您應該將
pg_hba.conf身份驗證方法更改為scram-sha-256并再次重置服務
參考:關于升級 postgres 密碼認證的資訊
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/415504.html
標籤:
