允许从任何计算机访问 Postgresql [英] Allow access to Postgresql from any computer
问题描述
在研究了 Postgresql 的 GUI 后,我发现 pgadmin 4 桌面客户端是一个有效的选择.
After researching GUI's for Postgresql I found the pgadmin 4 desktop client to be a valid choice.
我使用 Ubuntu 16.04 服务器(Digital Ocean 上的 Droplet)和 iptables 防火墙.
I use an Ubuntu 16.04 server (droplet on Digital Ocean) and iptables firewall.
如何允许从远程计算机访问?我安装了 pgadmin 的电脑有动态 IP.
How do I allow access from remote computers? My computers with pgadmin installed have dynamic ip's.
推荐答案
我想通过 pgadmin 等客户端从远程桌面计算机连接到我的云托管 Postgresql 数据库.
I wanted to connect to my cloud hosted Postgresql database from remote desktop computers with a client such as pgadmin.
为了实现这一点,我通过以下命令在 iptables 中打开了 5432 端口:
To achieve this I opened up port 5432 in iptables by the following commands:
iptables -I INPUT 1 -m tcp -p tcp --dport 5432 -j ACCEPT
service iptables save
service iptables restart
我允许从 Postgresql 中的任何位置访问,如下所示:
I allowed access from any location in Postgresql like so:
nano /etc/postgresql/9.5/main/postgresql.conf
像这样编辑listen_address:
Edit listen_address like so:
listen_addresses = '*'
保存并关闭nano编辑器并执行postgresql重启命令
save and close nano editor and execute the postgresql restart command
service postgresql restart
这篇关于允许从任何计算机访问 Postgresql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!