错误信息:
Failed to connect to the database: could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
解决方法:
这个问题的原因是你没有配置数据库的准许访问,一般在这个位置
vi /var/lib/pgsql/data/pg_hba.conf
得配置成这样
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all ident
# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
ok,就这样解决
主要参考的这里:
http://blog.youkuaiyun.com/bnxf00000/article/details/44872709