【问题标题】:PostgreSQL on Windows: is there a default password? [closed]Windows 上的 PostgreSQL:有默认密码吗? [关闭]
【发布时间】:2013-09-09 13:04:26
【问题描述】:

刚刚在 Windows7 上安装了 PostgreSQL。安装过程中没有要求我设置密码。当我运行 psql 时,我被要求输入密码。谷歌搜索了一些,唯一可能的默认密码是“postgre”。但这没有用。还尝试了空白密码和我的 Windows 密码。他们都没有工作。阅读一些高级的东西如何重设密码,但这不可能吗?我在这里想念什么?我应该输入什么密码?

【问题讨论】:

  • 自 8.0 版以来的任何安装程序都要求您输入密码。在 9.2 版之前,系统会要求您输入两个密码:一个用于 postgres 数据库用户,另一个用于 Windows 服务用户。
  • 问题是psql的默认用户名是Administrator,如果你按照安装程序,那么你只为用户postgres创建了一个密码,所以解决方案是运行psql -Upostgres指定用户postgres
  • 您被要求创建用户名和密码,但默认情况下 PostgreSQL 将尝试连接到安装时创建的集群作为 postgres
  • 我的是:用户名:postgres 密码:1234

标签: windows postgresql


【解决方案1】:

试试这个:

Open PgAdmin -> Files -> Open pgpass.conf

您会在窗口底部看到pgpass.conf 的路径。 转到该位置并打开此文件,您可以在那里找到您的密码。

Reference

如果上述方法不起作用,你可以考虑试试这个:

 1. edit pg_hba.conf to allow trust authorization temporarily
 2. Reload the config file (pg_ctl reload)
 3. Connect and issue ALTER ROLE / PASSWORD to set the new password
 4. edit pg_hba.conf again and restore the previous settings
 5. Reload the config file again

【讨论】:

  • 文件为空。我应该手动输入吗?
  • 用户:postgres,密码:密码
  • 对我来说,在 pgAdmin4 用户名:postgres 和密码:postgres 解决了.. 离开这里以防它帮助其他人。
  • @Sri9911 对我同样有效
猜你喜欢
  • 2010-10-18
  • 2011-08-14
  • 2014-07-29
  • 1970-01-01
  • 1970-01-01
  • 2014-07-09
  • 2016-06-05
  • 2010-09-06
相关资源
最近更新 更多