【发布时间】:2013-07-04 03:06:47
【问题描述】:
我正在尝试在本地机器上使用 pg_dump 工具。但是,当我在终端窗口中键入 pg_dump database_name 时,我会收到以下消息:
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 时,会发生一些不同的事情。但是,即使在重新启动后,我仍然会收到无法连接到服务器的错误消息(如上所述)。
接下来我应该尝试哪些步骤来解决此问题?
提前谢谢你
【问题讨论】:
-
我错了两件事,一是我没有安装pg_dump,二是数据库被关闭了!
标签: postgresql