打开data目录下的pg_hba.conf配置文件,找到:
# IPv4 local connections: host all all 127.0.0.1/32 md5
把md5改成trust
重启动
psql -d template1 -U postgres -c "alter role postgres password '123456';"
要不要把trust改回来就随便了。
配置PostgreSQL密码与信任登录
本文介绍如何通过修改PostgreSQL的配置文件pg_hba.conf来实现信任登录,并设置管理员postgres的密码。具体步骤包括将认证方式从md5改为trust,重启服务,使用psql命令设置密码。
打开data目录下的pg_hba.conf配置文件,找到:
# IPv4 local connections: host all all 127.0.0.1/32 md5
把md5改成trust
重启动
psql -d template1 -U postgres -c "alter role postgres password '123456';"
要不要把trust改回来就随便了。
1304
5403

被折叠的 条评论
为什么被折叠?