新建一个虚拟机,在本地跑程序,连虚拟机数据库报错:
no pg_hba.conf entry for host "192.168.1.4"
Google下,发现是要修改postgres数据库配置文件pg_hba.conf
一般存放在/var/lib/pgsql/9.4/data/pg_hba.conf这个目录下;
将里面的仅允许本机访问修改为:允许所有ip段访问
host all all 0.0.0.0/0 md5
最后重启postgres数据库:(因为我装的是9.4版本)
service postgresql-9.4 restart
over...