一、修改data目錄下的 pg_hba.conf 文件
將以下這行
host all all 127.0.0.1/32 md5
改爲如下:
host all all 127.0.0.1/32 trust
二、運行cmd,進入postgres安裝路徑的bin目錄,運行如下命令:
psql -U postgres
postgres=# alter user postgres with password '你要設置的密碼';
postgres=# \q
三、修改data目錄下的 pg_hba.conf 文件
將以下這行
host all all 127.0.0.1/32 trust
改爲如下:
host all all 127.0.0.1/32 md5
重新啓動postgres