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

时间:2014-05-12 12:59:41   收藏:0   阅读:416

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

bubuko.com,布布扣
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 ]
bubuko.com,布布扣

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

bubuko.com,布布扣

 

postgreSQL9.1忘记postgres用户密码怎么办,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!