postgresql远程连接失败怎么解决
小编给大家分享一下postgresql远程连接失败怎么解决,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨吧!
下载使用第三方软件Navicat for PostgreSQL管理postgresql。
推荐:PostgreSQL教程
连接时navicat报错:
could not connect to server:Connection refused (0x0000274D/10061)
解决方法:
1、关闭postgresql服务
[postgres@server2data]$./pg_ctl-D/opt/pgsql/data-llogfilestop
2、修改配置文件/opt/pgsql/data/postgresql.conf
listen_addresses=‘*’#whatIPaddress(es)tolistenon;#comma-separatedlistofaddresses;#defaultsto‘localhost’;use‘*’forall
注:不加引号pg无法启动
[postgres@server2bin]$./postgres-D/opt/pgsql/dataLOG:syntaxerrorinfile“/opt/pgsql/data/postgresql.conf”line60,neartoken“*”FATAL:configurationfile“/opt/pgsql/data/postgresql.conf”containserrors
3、修改pg_hba.conf
在该配置文件的ipv4配置后面的host all all 127.0.0.1/32 md5行下添加以下配置,或者直接将这一行修改为以下配置
hostallall0.0.0.0/0trust
4、重启服务
[postgres@server2data]$./pg_ctl-D/opt/pgsql/data-llogfilestart
看完了这篇文章,相信你对postgresql远程连接失败怎么解决有了一定的了解,想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。