【问题标题】:Cannot access postgres PSQL无法访问 postgres PSQL
【发布时间】:2019-02-21 08:39:37
【问题描述】:

我刚刚安装了 postgres (mac os),但是,当我访问 psql 时,它会尝试查找数据库而不是用户。

我知道用户名是 benbagley(因为那是我的系统名称)

我试过了。

➜  ~ psql
psql: FATAL:  database "benbagley" does not exist

➜  ~ psql -U benbagley
psql: FATAL:  database "benbagley" does not exist

【问题讨论】:

  • 显然没有名为 benbagley 的数据库,因此您需要指定要连接的数据库,例如连接到默认数据库postgres 使用psql -U benbagley -d postgres

标签: postgresql


【解决方案1】:

As stated in the manualpsql 假定数据库名称与未显式提供数据库时的用户名相同,并尝试连接该数据库,在您的情况下不存在该数据库。

尝试连接默认数据库,即 postgres。

psql -U username -d postgres

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-24
    • 2020-08-31
    • 2013-07-14
    • 2012-09-02
    相关资源
    最近更新 更多