我想为 Windows 本地数据库上的 postgres 用户设置密码。
目前我可以使用以下方式登录postgres “psql -U postgres” 无需密码
我的pg_hba文件如下
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
最佳答案
首先像往常一样使用psql -U postgres
登录并为用户postgres设置密码:
ALTER USER postgres PASSWORD 'your-new-password';
编辑文件 pg_hba.conf
并添加以下行:
local all postgres md5
最后重新启动postgres服务器。
关于windows - 在 Windows 上设置 postgres 用户密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32246765/