How to solve the error:
QSqlError("2003", "QMYSQL: Unable to connect", "Can't connect to MySQL server on '112.17.98.18' (111)")
When I try to connect to the remote database it shows the error given above. But when I connect to localhost it does not show any error.
My code is below. Please help if you can.
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("112.17.98.18"); // fake ip ;
db.setPort(3306);
db.setDatabaseName("root");
db.setUserName("root");
db.setPassword(" ");
db.open();
Comments
Post a Comment