我試圖在本地機器上使用pg_dump工具。但是,當我輸入的pg_dump database_name
到我的終端窗口中,我得到了消息:pg_dump與數據庫的連接失敗
pg_dump: [archiver (db)] connection to database "demo" failed:
could not connect to server: No such file or directory
收到此錯誤消息後,我走進我的postgressql.conf文件(Postgres的配置文件)和將listen_addresses設置爲*
。我的連接字符串如下出現:
- Connection Settings -
#listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
#port = 5432 # (change requires restart)
max_connections = 20 # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directory = '' # (change requires restart)
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
# (change requires restart)
#bonjour = off # advertise server via Bonjour
# (change requires restart)
#bonjour_name = '' # defaults to the computer name
# (change requires restart)
我再重新啓動我的機器,希望當我在pg_dump
在控制檯類型,不同的事情會發生。但是,即使在重新啓動後,我仍然無法連接到服務器錯誤消息(如上所述)。
接下來我應該嘗試哪些步驟來解決此問題?
謝謝你提前
克雷格!太棒了。謝謝 –
'-h localhost'在linux上的pg_dump上工作(ubuntu 16) –