将以下这行
host all all 127.0.0.1/32 md5
改为如下:
host all all 127.0.0.1/32 trust
如果开启ipv6的话,以下也要修改
IPv6 local connections:
host all all ::1/128 trust
psql -U postgres
postgres=# alter user postgres with password ‘你要设置的密码’;
一定注意要带上分号
postgres=# \q
还原 trust -> md5
将以下这行
host all all 127.0.0.1/32 trust
改为如下:
host all all 127.0.0.1/32 md5
ipv6的密码方式也修改
重新启动postgres