Home >Database >Mysql Tutorial >致命错误:没有用于主机"192.168.1.112",用户"pos

致命错误:没有用于主机"192.168.1.112",用户"pos

WBOY
WBOYOriginal
2016-06-07 14:53:423116browse

致命错误:没有用于主机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

 

    重新连接,一切正常.
 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn