【问题标题】:postgres server running in local host, but postico, pgadmin can't access to itpostgres 服务器在本地主机上运行,​​但 postico、pgadmin 无法访问它
【发布时间】:2016-12-17 00:03:49
【问题描述】:

我通过自制程序成功安装了postgres,并通过这样做将其设置为自动运行

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

所以,现在我可以从终端访问 psql(我使用 iterm2 + oh my zsh)

psql (9.6.1)
Type "help" for help.

ty2kim=#

问题是,postico、pgadmin等postgres管理工具无法访问

对于 postico,错误信息是

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5435?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5435?

这很奇怪,因为据我了解,如果配置正确,从终端和管理工具访问数据库基本相同

我的 pg_hba.conf 和 postgresql.conf 被设置为默认值(在那里没有做任何更改),但我尝试这样做

listen_addresses = 'localhost'  
=>
listen_addresses = '*'
(restart server)

还是不行

请帮忙!

【问题讨论】:

    标签: postgresql tcp connection localhost pgadmin


    【解决方案1】:

    端口 5435 不是 PostgreSQL 的标准。你确定PG在上面运行吗?如果你没有在 postgresql.conf 中更改它,它必须是 5432。请检查它。

    【讨论】:

      【解决方案2】:
      1. 必须检查 pg_hba.conf。如果没有太多限制,您可以通过以下行将该文件放在该文件的末尾: 托管所有所有所有信任

      之后,重新加载/重启实例。

      1. 检查您的 PC 是否使用防火墙。如果是,请关闭它。

      【讨论】:

      • 关闭运行服务器的机器上的防火墙是一个非常糟糕的主意。
      猜你喜欢
      • 2020-09-27
      • 1970-01-01
      • 2021-12-17
      • 2014-11-29
      • 2015-06-03
      • 2020-07-12
      • 1970-01-01
      • 1970-01-01
      • 2018-05-20
      相关资源
      最近更新 更多