2014-09-27 298 views
0

我一直在试图连接到我的postgresql 9.3服务器,但我不断收到此错误。Postgresql拒绝连接到服务器

Server doesn't listen 
The server doesn't accept connections: the connection library reports 
could not connect to server: Connection refused (0x0000274D/10061) 
Is the server running on host "localhost" (::1) and accepting TCP/IP 
connections on port 5433? could not connect to server: Connection  
refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) 
and accepting TCP/IP connections on port 5432? 

我试着通过pgadmin3和命令行进行连接。

psql.exe -h localhost -U postgres 

该命令也给出了相同的错误。

我在一台Windows机器上。我曾尝试创建一个单独的服务器也具有相同的结果。

我不知道发生了什么。请帮忙。

感谢

+2

本地主机“(127.0.0.1) 并接受在端口5432 * TCP/IP连接?‘’*是运行在主机上的服务器” - 究竟什么是这个问题的答案题? – 2014-09-27 22:06:13

+1

另外,您是否在计算机上安装了第三方防火墙?如果他们尝试过滤本地环回流量,它们可能会导致问题。这是一个愚蠢的事情,但许多第三方防火墙正是如此 - 非常愚蠢。 – 2014-09-28 01:27:50

+0

感谢您花时间看我的问题。我想到了。启动服务器 – 2014-09-28 02:52:44

回答

1

开始与Postgres的服务器-D [ 'data文件夹']

如文档:

http://www.postgresql.org/docs/9.1/static/server-start.html

所以在bin文件夹我的Windows安装的Postgres:

postgres.exe -D .. \ data

其中数据是在PostgreSQL安装文件夹

+0

要在后台运行,请使用:pg_ctl.exe start -D .. \ data – 2014-09-28 03:50:18

+0

如果您得到错误服务管理器未启动:以管理员模式打开命令窗口。然后运行pg_ctl注册-N“Postgres服务器”-D .. \ data -s auto。这将启动postgres作为电脑启动时的一项服务 – 2014-09-28 05:07:03