Postgresql安装完成之后,默认情况下是不允许远程客户端直接连接的,并且默认的监听配置文件里边,监听的服务器地址是127.0.0.1即:localhost

报如下错误:

org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "<host_ip>", user "fkong", database "fkong", SSL off

因此我们需要修改两个地方,pg_hba.conf  postgresql.conf

odoo@odooV01:/etc/postgresql/9.6/main$ pwd
/etc/postgresql/9.6/main
odoo@odooV01:/etc/postgresql/9.6/main$
odoo@odooV01:/etc/postgresql/9.6/main$ ls
environment pg_ctl.conf pg_hba.conf pg_ident.conf postgresql.conf start.conf
odoo@odooV01:/etc/postgresql/9.6/main$

(1)在PostgreSQL数据库的安装目录下找到pg_hba.conf, vi打开,找到

“# IPv4 local connections:”

在其下加上请求连接的机器IP

默认配置:host all all 127.0.0.1/32 md5

32是子网掩码的网段;md5是密码验证方法,可以改为trust

即:

host all all 你的客户端IP/32 trust

或者允许所有不同网段机器访问:

host all all 0.0.0.0/0 trust

(2) 同样在该目录下,vi 打开postgresql.conf文件 找到 listen_addresses = 'localhost' 这一行,

修改为:listen_addresses = '*'

(3) 重启postgresql服务,和其他服务一样还是用systemd进行管理:

切换到:postgres用户 执行重启服务操作:

systemctl stop postgresql-9.6 #停止服务
systemctl start postgresql-9.6 #启动服务
其他命令:
systemctl restart postgresql-9.6 #重启服务
systemctl enable postgresql-9.6 #自动启动 service postgresql-10 start
或者(注意不同的版本指定不同版本号)
service postgresql-9.6 start

其他:

http://blog.csdn.net/ghostliming/article/details/53312493

http://www.jb51.net/article/53011.htm

http://www.jb51.net/article/104829.htm

http://blog.csdn.net/kongxx/article/details/5964638

http://francs3.blog.163.com/blog/static/4057672720138953548912/

最新文章

  1. 高性能MySQL(五):查询性能优化
  2. EF架构~在global.asax里写了一个异常跳转,不错!
  3. BZOJ 2733 &amp; splay的合并
  4. LINQ to Entities 和LINQ to Objects 的区别
  5. MySQL 索引详解大全
  6. CentOS 6.6 nginx install
  7. angularJs的ui-router总结
  8. 1.4.2 solr字段类型--(1.4.2.6)使用外部文件和程序
  9. zencart技术联盟交流群
  10. light工具
  11. sonar-maven-plugin错误2
  12. ”ENV_IS_EMBEDDED“解惑以及相关的移植实验
  13. 磁盘IO子系统学习资料
  14. QWebView 播放网络视频
  15. pre强制 自动换行
  16. UICollectionView自定义cell布局layout
  17. PHP在使用正则表达式验证,防注入的时候要注意一下的细节
  18. [转载]strtok函数和strtok_r函数
  19. StringUtils类中 isEmpty() 与 isBlank()的区别
  20. 时序数据库技术体系 – InfluxDB 多维查询之倒排索引

热门文章

  1. ES6通过使用babel兼容到ie9
  2. python3.4用函数操作mysql5.7数据库
  3. 程序重复报more than &#39;max_user_connections&#39; active connections问题解决
  4. C#时间操作总结
  5. 1.4isAlive()方法
  6. 51nod 1239 欧拉筛模板
  7. linux-CentOS初学terminal命令(2)vi、gcc、g++、./、mv、cp、ifconfig
  8. MySQL数据库与表的增删改查
  9. Java关联关系、依赖关系
  10. CAD:计算三角形的外接圆圆心