远程连接到PostgreSQL数据库
我正在尝试从我的个人电脑在 pgAdmin 上远程连接到另一个网络上的 Windows 10 电脑上托管的数据库。
采取的步骤:
- 将 postgresql.conf 文件中的
listen_addresses = 'localhost'
更改为listen_addresses = '*'
。 - 将
host all all 0.0.0.0/0
行添加到 pg_hba.conf 文件中。 - 重新启动 postgresql 服务。
- 在防火墙中打开端口 5432
尝试通过我的 PC 上的 pgAdmin 连接到数据库,输入:
- 主机名:托管计算机数据库的 IPv4 地址。
- 端口:5432,数据库:postgres,用户:postgres,密码:password
除了每次都出现连接超时错误之外,我看不到任何错误,但我不知道为什么。我增加了连接超时时间,但仍然没有连接。 PostgreSQL 服务正在运行,我可以在托管 PC 上通过 pgAdmin 连接到数据库。
任何人都可以让我知道我是否要跳过某个步骤或需要添加到配置文件中的其他内容吗? 谢谢
I'm trying to connect remotely on pgAdmin to a database hosted on a Windows 10 PC on another network from my personal PC.
Steps taken:
- Changed
listen_addresses = 'localhost'
tolisten_addresses = '*'
in postgresql.conf file. - Added line
host all all 0.0.0.0/0
to pg_hba.conf file. - Restarted postgresql service.
- Opened port in firewall for port 5432
Tried to connect to database via pgAdmin on my PC by entering:
- Host name: IPv4 address of machine database is hosted on.
- Port:5432, Database: postgres, user: postgres, password: password
I can't see any error except a connection timed out error every time, but I don't know why. I've increased the connection timeout duration but still no connection. PostgreSQL service is running and I can connect to the database via pgAdmin just fine on the hosting PC.
Can anyone let me know if I'm skipping a step or anything else I need to add to the config files?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论