• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

postgresql远程连接失败

mysql 搞java代码 3年前 (2022-05-21) 14次浏览 已收录 0个评论

下载使用第三方软件Navicat for PostgreSQL管理postgresql

推荐:PostgreSQL教程

连接时navicat报错:

could not connect to server:Connection refused (0x0000274D/10061)

解决方法:

1、关闭postgresql服务

[postgres@server2 <a href="https://www.gaodaima.com/tag/data" title="查看更多关于data的文章" target="_blank">data</a>]$./pg_ctl -D /opt/pgsql/data -l logfile stop

www#gaodaima.com来源gaodai#ma#com搞*!代#%^码$网搞代码

2、修改配置文件/opt/pgsql/data/postgresql.conf

listen_addresses = ‘*’ # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to ‘localhost’; use ‘*’ for all

注:不加引号pg无法启动

[postgres@server2 bin]$ ./postgres -D /opt/pgsql/data
LOG: syntax error in file “/opt/pgsql/data/postgresql.conf” line 60, near token “*”
FATAL: configuration file “/opt/pgsql/data/postgresql.conf” contains errors

3、修改pg_hba.conf

在该配置文件的ipv4配置后面的host all all 127.0.0.1/32 md5行下添加以下配置,或者直接将这一行修改为以下配置

host all all 0.0.0.0/0 trust

4、重启服务

[postgres@server2 data]$./pg_ctl -D /opt/pgsql/data -l logfile start

更多Python知识请关注云海天Python教程栏目。

来源:搞代码网:原文地址:https://www.gaodaima.com


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:postgresql远程连接失败

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址