【问题标题】:Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? [closed]服务器是否在主机“localhost”(::1) 上运行并接受端口 5432 上的 TCP/IP 连接? [关闭]
【发布时间】:2013-07-15 07:17:43
【问题描述】:

我正在研究 Django。我使用 PostgreSQL 数据库。

完全错误说:

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

你有什么想法吗?

【问题讨论】:

  • 检查您的 postgresql 服务器设置。
  • 我已经在我的机器上安装了 PostgreSQL。仍然没有开始服务......有什么想法吗??

标签: postgresql


【解决方案1】:

在黑暗中野蛮刺伤:您在一台带有 IPv6 解析器的机器上,其中localhost 默认为 IPv6 地址::1,但postgresql.conf 中的listen_addresses 设置为127.0.0.10.0.0.0不是*,或者您使用的是使用不支持透明 IPv6 的 C 库构建的旧版 PostgreSQL。

listen_addresses 更改为 localhost 并确保 localhost 解析为 IPv4 和 IPv6 地址,或将其设置为 ::1, 127.0.0.1 以明确指定 IPv4 和 IPv6。或者只是将其设置为* 以监听所有接口。或者,如果您不关心 IPv6,请连接到 127.0.0.1 而不是 localhost

请参阅this Google searchthis Stack Overflow search 了解更多信息。

(尽管我投了赞成票,但仍发帖,因为我投票支持迁移问题)。

【讨论】:

  • 已经有一段时间了,但我遇到了同样的错误,并通过在 postgresql.conf 中将我的监听端口更改为 5432(原为 5433)来修复它,但是如果我想将我的 5433 保留在 conf 中呢??
  • @J.M.Echevarría 在连接时指定客户端的端口。
猜你喜欢
  • 2018-01-20
  • 2018-12-17
  • 2021-11-29
  • 1970-01-01
  • 1970-01-01
  • 2017-06-09
  • 1970-01-01
  • 1970-01-01
  • 2016-05-30
相关资源
最近更新 更多