加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql – 使用psql命令远程连接到Postgres实例

发布时间:2020-12-13 16:08:05 所属栏目:百科 来源:网络整理
导读:我想远程连接到Postgres实例.我知道我们可以使用传递主机名的psql命令来完成此操作 我尝试了以下方法: psql -U postgres -p 5432 -h hostname 我修改了目标机器上的/etc/postgresql/9.3/main/pg_hba.conf文件以允许默认远程连接 我在文件中添加了以下行 hos
我想远程连接到Postgres实例.我知道我们可以使用传递主机名的psql命令来完成此操作

我尝试了以下方法:

psql -U postgres -p 5432 -h hostname

我修改了目标机器上的/etc/postgresql/9.3/main/pg_hba.conf文件以允许默认远程连接

我在文件中添加了以下行

host all all source_ip/32 trust

我使用重新启动集群

pg_ctlcluster 9.2 mycluster stop
pg_ctlcluster 9.2 mycluster start

但是,当我尝试从source_ip连接时,我仍然得到错误

Is the server running on host “” and accepting TCP/IP connections on port 5432?

我在这做错了什么?

解决方法

我想到了.

不得不在postgresql.conf中设置listen_addresses =’*’以允许来自任何ip / all ip的传入连接

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读