Postgresql 安裝後登錄 SQL Shell(psql),報 FATAL: password authentication failed for user “postgres“

    問題:

        Postgresql 數據庫安裝後,登錄SQL Shell(psql),報FATAL: password authentication failed for user "postgres"。

 

    原因:

        主要是由於用戶密碼認證方式引起的,Postgresql 數據庫安裝好後默認採用 md5 密碼加密認證方式。

 

    解決辦法:

        (1) 打開 Postgresql 安裝目錄下的 data 文件夾,找到 pg_hba.conf 文件並打開。

        (2) 如下圖所示,修改認證方式,將 md5 全部改為 trust,然後保存。

 

Postgresql 安裝後登錄 SQL Shell(psql),報 FATAL: password authentication failed for user “postgres“