【问题标题】:Postgresql - postgres@localhost failed FATAL: role does not existPostgresql - postgres@localhost 失败致命:角色不存在
【发布时间】:2016-07-15 15:13:25
【问题描述】:

我刚刚安装了 postgres(使用 brew)并使用 pg_ctl -D /usr/local/var/postgres -l logfile start 启动它

我现在尝试在终端中连接它,但得到以下信息:

与 PostgreSQL 的连接 - postgres@localhost 失败 致命:角色“我”不存在

问题可能是我先安装了 postgres.app,然后没有让它正常工作,然后又将其删除。

【问题讨论】:

  • 您最初应该使用的帐户是postgres,它不需要密码。
  • 我运行 'su postgres' 然后 initdb /usr/local/var/postgres9.5 -E utf8 但我得到 creating directory /usr/local/var/postgres9.5 ... initdb: could not create directory "/usr/local/var/postgres9.5": Permission denied
  • 由于某种原因,当我运行 initdb 时,我得到了使用 root 用户创建的 var/postgres 目录
  • 实际上,我只是检查了我的 mac 上的用户,我有一个 postgresql 用户,我认为这是因为我从 postgres.app 开始,然后切换到 brew,它只是混淆了一些东西,不知道该做什么现在就做@Nicarus

标签: postgresql homebrew


【解决方案1】:

您没有显示您输入的内容以及您输入的用户身份,但从错误消息中我会说您应该将 -U postgres 添加到 psql 调用中。

【讨论】:

  • 享受有史以来最简单的赏金......可能
  • 好吧,如果它对你有用,那就大功告成了。如果没有,请告诉我更多细节。
  • 我可以在 15 小时内获奖
  • 由于某种原因,我现在得到FATAL: role "postgres" does not exist 任何简单的解决方法?
  • 你是DROP USER postgres还是什么?如果数据库中没有超级用户,则必须停止服务器,按照here 所述以单用户模式启动它,然后查看SELECT * FROM pg_authid 并在必要时重新创建用户。
猜你喜欢
  • 2023-01-26
  • 1970-01-01
  • 1970-01-01
  • 2013-01-28
  • 2013-02-24
  • 2017-05-25
  • 2017-12-20
相关资源
最近更新 更多