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

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

WBOY
Release: 2016-06-07 14:53:42
Original
3117 people have browsed it

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

 

    重新连接,一切正常.
 

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template