yangxianyang

1.修改pg_hba.conf配置文件

sudo vi /Library/PostgreSQL/10(写成你的版本)/data/pg_hba.conf

把文件近末尾处,local由"md5"改为"trust":

保存并退出。

2.查看PostgreSQL的服务名

ls /Library/LaunchDaemons

此处PostgreSQL服务名为:

com.edb.launchd.postgresql-10.plist

3.重启PostgreSQL服务

停止服务:

sudo launchctl stop com.edb.launchd.postgresql-10.plist

启动服务:

sudo launchctl start com.edb.launchd.postgresql-10.plist

 

4.启动Postgre会话

psql -U postgres

进入psql会话:

5.重置密码

修改密码:

ALTER USER postgres WITH PASSWORD \'新密码\';

操作完成,执行:\q命令回车退出。

 

6.恢复pg_hba.conf设置为md5并重启服务

分类:

技术点:

相关文章:

  • 2022-02-14
  • 2021-11-05
  • 2021-11-21
  • 2021-10-20
  • 2021-12-24
  • 2021-11-11
  • 2021-12-14
  • 2021-12-14
猜你喜欢
  • 2021-11-03
  • 2021-12-14
  • 2021-12-04
  • 2021-10-24
  • 2021-12-14
  • 2021-12-14
  • 2021-09-25
相关资源
相似解决方案