如何在Mac OS X 10.8.2上重置Postgresql 9.2默认用户(通常为"postgres")密码? [英] How do I reset the postgresql 9.2 default user (usually 'postgres') password on mac os x 10.8.2?
本文介绍了如何在Mac OS X 10.8.2上重置Postgresql 9.2默认用户(通常为"postgres")密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚从 enterprisedb 安装了PostgreSQL 9.2
到Mac OS X 10.8.2
上.我输错了postgres
用户密码,因此无法连接.如何重置密码?
I just installed PostgreSQL 9.2
from enterprisedb onto Mac OS X 10.8.2
. I mistyped my postgres
user password, so I can't connect. How do I reset the password?
推荐答案
修改/Library/PostgreSQL/9.2/data/pg_hba.conf
modify /Library/PostgreSQL/9.2/data/pg_hba.conf
-local all all md5
+local all all trust
重新启动postgres
restart postgres
/Library/PostgreSQL/9.2/bin/pg_ctl restart -D /Library/PostgreSQL/9.2/data/
连接到postgres:
Connect to postgres:
psql
在psql内部(\q
退出):
Inside psql (\q
to quit):
ALTER USER postgres WITH ENCRYPTED PASSWORD 'password';
重新修改pg_hba.conf
modify pg_hba.conf back
+local all all md5
-local all all trust
重新启动postgres
restart postgres
/Library/PostgreSQL/9.2/bin/pg_ctl restart -D /Library/PostgreSQL/9.2/data/
这篇关于如何在Mac OS X 10.8.2上重置Postgresql 9.2默认用户(通常为"postgres")密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文