PostgreSQL数据库忘记密码的解决方案

来源:互联网 发布:linux 搭建go编译环境 编辑:程序博客网 时间:2024/05/16 15:06

问题:忘了PostgreSQL数据库的密码应该如何解决?

解决方法:

首先打开data目录下的pg_hba.conf配置文件,找到:

 

# IPv4 local connections:host    all         all         127.0.0.1/32          ident

然后把ident改成trust,重新启动。

 

psql -d template1 -U postgres -c "alter role postgres password ‘123456’;"
原创粉丝点击