database 连接到 PostgreSQL 服务器被拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24653728/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Connection refused to PostgreSQL server
提问by Aurel
I am currently setting up a postreSQL server on my Windows computer.
我目前正在我的 Windows 计算机上设置 postreSQL 服务器。
I want to create my first database, but couldn't create the createdb function due to a password authetification failed. Thus I found the following question on this website:
我想创建我的第一个数据库,但由于密码验证失败而无法创建 createdb 函数。因此我在这个网站上发现了以下问题:
How to configure postgresql for the first time?
However, I think I forgot the ; at the end of :
但是,我想我忘记了;在......的最后 :
ALTER USER postgres with encrypted password 'xxxxxxx';
And now, when I try to launch psql, I have the following errors:
现在,当我尝试启动 psql 时,出现以下错误:
Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Active code page: 1252
psql: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
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?
Press any key to continue . . .
Any idea of what I could do to solve the problem?
知道我能做些什么来解决这个问题吗?
Do you think it is really the missing semi column that caused the problem?
你认为真的是缺失的半柱导致了问题吗?
Do you have any tutorial on how to setup a postgreSQL database on Windows? All the one I found until now were for Linux only.
你有关于如何在 Windows 上设置 postgreSQL 数据库的教程吗?到目前为止,我发现的所有软件都仅适用于 Linux。
回答by edenzik
The error you're getting appears to be from Postgres not currently running, rather than an authentication error as you're presumed. The PSQL client or whatever PG client you're using is attempting to establish a connection on the default port but nothing is there.
您收到的错误似乎来自当前未运行的 Postgres,而不是您假设的身份验证错误。PSQL 客户端或您使用的任何 PG 客户端正在尝试在默认端口上建立连接,但什么也没有。
If Postgres isn't currently running, try finding it (Via CTRL-Alt-Delete). If it's running, try terminating it and starting it up again. Hopefully that fixes the problem... Otherwise your port 5432 might be blocked for some reason.
如果 Postgres 当前未运行,请尝试查找它(通过 CTRL-Alt-Delete)。如果它正在运行,请尝试终止它并重新启动它。希望这能解决问题...否则您的端口 5432 可能因某种原因被阻止。
If all fails, I am still skeptical the parentheses could cause this error because it's not an authentication error. Try to reinstall Postgres with a clean install.
如果一切都失败了,我仍然怀疑括号是否会导致此错误,因为它不是身份验证错误。尝试通过全新安装重新安装 Postgres。

