postgresql/pgAdmin - 服务器不监听问题

标签 postgresql pgadmin

我正在我的新 macbook pro 上设置 postgresql/pgadmin。但是,当我注册一个新服务器时,出现错误:

Server doesn't listen
The server doesn't accept connections: the connection library reports 
could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? 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 5432? 

我浏览了这个问题,显然答案是编辑 pg_hba.conf 文件。但是,我需要帮助:

1) 如何找到并打开该文件?

2) 打开它后,我需要添加哪些语句来解决问题?

有人可以帮忙吗?

提前致谢!

最佳答案

它位于 data 文件夹内。

Eg: PostgreSQL\9.4\data\pg_hba.conf

在那里你会找到以下地方。

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5

如果您想从不同的 IP 访问,请添加更改 IP 的同一行的副本。 解释得很好here .

另外,我建议您检查放置在同一目录中的 postgresql.conf 是否有以下行的注释。

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'      # what IP address(es) to listen on;

关于postgresql/pgAdmin - 服务器不监听问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37515400/

相关文章:

postgresql - SQLSTATE[08006] [7] 预期来自服务器的身份验证请求,但收到 _

postgresql - 如何在 PostgreSQL 中显示所有对象及其注释?

mysql - 在 postgres 的不同列中获取联合的输出

amazon-redshift - pgAdmin 中的权限被拒绝设置参数

linux - Debian 上的 pgadmin 黑色背景字体

php - PostgreSQL 数据库似乎不适用于 GeoServer

sql - 使用 PostgreSQL 在同一查询中更新多行

ruby-on-rails - 无法检测保存嵌套对象时的错误

postgresql - 如何在 PostgreSQL 中存储一组查询,以便我可以轻松地再次运行它?

postgresql - PgAdmin III,打开服务器状态给出 "invalid byte sequence for encoding UTF8"