postgresql 在 pgadmin 中创建新的本地服务器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/53267642/
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
Create new local server in pgadmin?
提问by Theo F
I have PostgreSQL 11 and PGadmin 4 installed on windows. Currently I'm connected to a AWS server which hosts all of my data.
我在 Windows 上安装了 PostgreSQL 11 和 PGadmin 4。目前,我已连接到托管我所有数据的 AWS 服务器。
I want to create a local server (localhost) as a testing environment where I can experiment. I can't seem to do it though, and the other similar questions on stack don't help. Here's what my process is:
我想创建一个本地服务器 (localhost) 作为我可以进行实验的测试环境。不过,我似乎无法做到,堆栈上的其他类似问题也无济于事。这是我的过程:
in pgAdmin, right click 'Servers' and go Create>Server
On the 'Create - Server' pop up box, i type in Name: Localserver. For 'connection' I type localhost. Port I leave as default '5432', db: postgres, username: postgres password: empty
click save.
在 pgAdmin 中,右键单击“服务器”并转到“创建”>“服务器”
在“创建 - 服务器”弹出框中,我输入名称:Localserver。对于“连接”,我输入 localhost。端口我保持默认'5432',db:postgres,用户名:postgres 密码:空
点击保存。
however, I get an error:
但是,我收到一个错误:
Unable to connect to server:
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?
无法连接到服务器:
无法连接到服务器:连接被拒绝 (0x0000274D/10061) 服务器是否在主机“localhost”(::1) 上运行并接受端口 5432 上的 TCP/IP 连接?
无法连接到服务器:连接被拒绝 (0x0000274D/10061) 服务器是否在主机“localhost”(127.0.0.1) 上运行并接受端口 5432 上的 TCP/IP 连接?
What should I do? I am the admin if that makes a difference.
我该怎么办?如果这有所作为,我是管理员。
回答by Chris Curvey
This is probably one of two things.
这可能是两件事之一。
You have set up a Postgres server, but have not adjusted
listen_addresses
in your postgresql.conf file, orYou have not set up a Postgres server on your local machine. ("Create Server" is a bit misleading, it should probably be "Create Server Connection".)
您已经设置了 Postgres 服务器,但尚未
listen_addresses
在您的 postgresql.conf 文件中进行调整,或者您尚未在本地计算机上设置 Postgres 服务器。(“创建服务器”有点误导,它可能应该是“创建服务器连接”。)
回答by richyen
Usually a “connection refused” error indicates that the database server is either 1) not running, or 2) configured in such a way that it is not listening to the right port or IP address. Be sure to check ps -ef
to see if Postgres is running, and also look at postgresql.conf
to see if port
and listen_addresses
are set properly.
通常,“连接被拒绝”错误表示数据库服务器 1) 未运行,或 2) 配置为未侦听正确的端口或 IP 地址。请务必检查ps -ef
Postgres 是否正在运行,并postgresql.conf
查看是否正确设置了port
和listen_addresses
。