新建服務器出現錯誤 Peer authentication failed for user "postgres" 的解決辦法


用pgadmin3 新建服務器出現錯誤 Peer authentication failed for user "postgres"

在stackoverflow上找到答案,出現此錯誤的原因是:

Peer authentication 是默認的配置,如果你的計算機用戶名和你的postgres數據庫名是一樣的話,那么就不會出現此錯誤,不需要為你的數據庫設置密碼。

還有一種md5 authentication,它需要密碼。

而我的計算機用戶名和我的數據庫名不一致,所以需要把Peer authentication改成md5 authentication,然后給數據庫設置密碼。

在哪里改?

/etc/postgresql/9.3/main/pg_hba.conf

執行命令

找到下面的一行:

local   all             postgres                                peer

改成

local   all             postgres                                md5

然后restart postgresql server

sudo service postgresql restart


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM