macos - 如何在 mac os x 10.8.2 上重置 postgresql 9.2 默认用户(通常为 'postgres' )密码?

标签 macos postgresql

我刚刚从 enterprisedb 安装了 PostgreSQL 9.2Mac OS X 10.8.2。我输错了 postgres 用户密码,因此无法连接。如何重置密码?

最佳答案

Found directions :

sudo su postgres

修改/Library/PostgreSQL/9.2/data/pg_hba.conf

-local all all   md5
+local all all   trust

重启 postgres

/Library/PostgreSQL/9.2/bin/pg_ctl restart -D /Library/PostgreSQL/9.2/data/

连接到 postgres:

psql

在 psql 内部(\q 退出):

ALTER USER postgres WITH ENCRYPTED PASSWORD 'password';

修改pg_hba.conf回来

+local all all   md5
-local all all   trust

重启 postgres

/Library/PostgreSQL/9.2/bin/pg_ctl restart -D /Library/PostgreSQL/9.2/data/

关于macos - 如何在 mac os x 10.8.2 上重置 postgresql 9.2 默认用户(通常为 'postgres' )密码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13921380/

相关文章:

Postgresql 仅加入最特定的 cidr 匹配

json - 如何计算嵌套在 Postgresql JSON 中的数字?

ruby-on-rails-3 - 无法安装 pg gem (Rails 3 - Cygwin) - sh : : command not found

postgresql - 为什么SET CONSTRAINTS ALL DEFERRED on Postgresql需要很长时间?

objective-c - 如何在 cocoa 中创建一个黑色圆角窗口

macos - 在 Sublime Text 2 中使用默认的 ruby​​ 版本

iphone - 如何将资源编译成二进制文件?

linux - 正确的 zsh shell 命令转义

ruby - ActiveRecord::AdapterNotSpecified 数据库配置没有指定适配器

mysql - Homebrew Mariadb Mysql 安装 root 访问被拒绝