温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

postgresql远程连接失败怎么解决

发布时间:2020-07-15 16:24:15 来源:亿速云 阅读:659 作者:清晨 栏目:编程语言

小编给大家分享一下postgresql远程连接失败怎么解决,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨吧!

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

推荐:PostgreSQL教程

连接时navicat报错:

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

解决方法:

1、关闭postgresql服务

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

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

看完了这篇文章,相信你对postgresql远程连接失败怎么解决有了一定的了解,想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI