[英]psql: FATAL: password authentication failed for user "postgres" postgresql version 10
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並再次重置服務我知道在需要為psql識別密碼時設置新密碼(在 CMD 中)是解決我的問題:
set PGPASSWORD= #type here the password you want to set
設置后,您編寫以下內容(例如):
psql -h 188.81.81.92 -U postgres -d postgres -p 5432
其中-h代表主機,-U代表用戶,-d代表數據庫根目錄,-p代表端口,使用postgreSQL語言。
在 windows 中,可能會出現問題:錯誤:連接到服務器 (...),可以通過鍵入以下內容來解決:
C:\\Program Files\\PostgreSQL\\14\\bin\\psql.exe
也就是說,您打開文件psql.exe ,它會正常工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.