首先打开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的配置文件pg_hba.conf启用信任认证,并设置管理员密码。首先将md5验证方式更改为trust,接着重启服务。最后使用psql命令为postgres角色设置新密码。
首先打开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是否改回来都无足轻重了。
817
5416
1797

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