致命错误:没有用于主机192.168.1.112,用户postgres解决 安装postgresql9.2后,qt连接数据库: cpp代码 www.2cto.com qsqldatabase db = qsqldatabase::adddatabase(qpsql,test); db.setdatabasename(sqlscada); //db.sethostname(127.0.0.1); db.sethostname(1
致命错误:没有用于主机192.168.1.112,用户postgres解决
安装postgresql9.2后,qt连接数据库:
cpp代码 www.2cto.com
qsqldatabase db = qsqldatabase::adddatabase(qpsql,test);
db.setdatabasename(sqlscada);
//db.sethostname(127.0.0.1);
db.sethostname(192.168.1.112);
db.setport(5432);
db.setusername(postgres);
db.setpassword(scada);
用127.0.0.1连接本机ok,指定ip地址连接就报错: 致命错误:没有用于主机192.168.1.112,用户postgres;
打开$postsql/data/pg_hdb.conf 找到
# ipv4 local connections:
host all all 127.0.0.1/32 md5
在下面添加一行代码:
host all all 192.168.1.112/32 md5
重新连接,一切正常.
