在网络上找了一篇文章http://www.linuxidc.com/Linux/2010-04/25232.htm,如下:

Ubuntu 9.10下PostgreSQL 8.4忘记密码的解决方法
Ubuntu 9.10下PostgreSQL 8.4忘记密码的解决方法:

1.
编辑pg_hba.conf中的
83 # IPv4 local connections:
84 host    all         all         127.0.0.1/32          trust

mickey@pentest:/etc/postgresql/8.4/main$ sudo vim pg_hba.conf
mickey@pentest:/etc/postgresql/8.4/main$ sudo /etc/init.d/postgresql-8.4 restart
* Restarting PostgreSQL 8.4 database server    

2.
mickey@pentest:~$ psql -h 127.0.0.1 -U postgres
psql (8.4.2)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type “help” for help.
postgres=# ALTER USER postgres WITH PASSWORD ‘mickey’;
ALTER ROLE
postgres=# \q

3.
将pg_hba.conf中的该回
83 # IPv4 local connections:
84 host    all         all         127.0.0.1/32          md5

mickey@pentest:/etc/postgresql/8.4/main$ sudo vim pg_hba.conf
mickey@pentest:/etc/postgresql/8.4/main$ sudo /etc/init.d/postgresql-8.4 restart
* Restarting PostgreSQL 8.4 database server                                              [ OK ]

经过测试,也适用windows版本下9.1。

postgreSQL9.1忘记postgres用户密码怎么办

 

相关文章:

  • 2022-01-04
  • 2021-10-15
  • 2021-07-02
  • 2021-12-15
  • 2021-11-22
  • 2022-01-01
  • 2021-09-11
  • 2021-08-26
猜你喜欢
  • 2022-01-22
  • 2021-10-24
  • 2022-01-19
  • 2021-12-09
  • 2021-06-30
  • 2022-01-08
  • 2021-11-22
相关资源
相似解决方案