【问题标题】:Postgres.app says "Running on Port 5432" but psql command failsPostgres.app 说“在端口 5432 上运行”但 psql 命令失败
【发布时间】:2013-06-02 00:58:06
【问题描述】:

我安装了 Postgres.app,当我打开它时,菜单栏图标显示“在端口 5432 上运行”。但是当我点击“Open psql”菜单选项时,我看到以下消息:

/Applications/Postgres.app/Contents/MacOS/bin/psql ; exit;
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
logout

[Process completed]

有什么想法吗?

【问题讨论】:

    标签: postgresql


    【解决方案1】:

    它很可能在不同的位置,有几种方法可以解决这个问题。

    1. 连接时使用 tcp 而不是 unix 套接字 (-h localhost)
    2. 在连接时指定正确的套接字(您可以通过:netstat -ln | grep PGSQL 获取)
    3. 通过修改您的 postgresql.conf 并更改 unix_socket_directory 变量来更改套接字的位置。

    【讨论】:

    • Aaa 让我的电脑进入睡眠状态并重新唤醒它似乎可以解决它。当我重新启动 Postgres.app 时,我得到一个对话框来“接受”或“拒绝”网络连接。奇怪的是,我以前只看到这个盒子闪烁——以为我看到了东西。我当然点击了“接受”,一切都很好。很奇怪。尽管如此,我还是接受了你的回答并支持 Cody Caughlan 的回答 - 我很感激这些提示!
    • 您还可以通过提供psql 的路径来指定要连接的套接字目录,例如psql -h /var/pgsql/socket 或任何您的套接字目录。
    【解决方案2】:

    根据:

    http://postgresapp.com/documentation

    尝试在命令行上连接:

    $ psql -h localhost
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-28
      • 1970-01-01
      • 2021-08-08
      • 2017-07-23
      相关资源
      最近更新 更多