2016-05-29 73 views
1

我在我的新的macbook pro上設置postgresql/pgadmin。然而,當我註冊一個新的服務器,我得到的錯誤: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)一旦我打開它,我需要添加哪些語句來解決該問題?

有人可以幫忙嗎?

在此先感謝!

+0

文件和它的位置和語法是記錄在手冊中:https://www.postgresql.org/docs/current/static/client-authentication.html參見[這裏](https://開頭stackoverflow.com/search?q=[postgresql]+[pgadmin]+Is+the+server+running+on+host+%22localhost%22) –

回答

1

它位於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;