QT mysql connectivity issue on other than default port
Hi,
I have QT mysql connectivity issue.
I have created one docker instance where I have installed mysql. This mysql instance is running
on port 6603 and not a regular port of 3306.
This port is open and is accessible from outside as well. Now I am connecting to this mysql instance
from all other applications which is not built using QT, like I am able to connect using node js or
any other 3rd party mysql editor. This means there is no connectivity issue.
But when I try to connect to this server using QSqlDatabase, it is either not connecting or says access denied.
However, if I change the above server port from 6603 to default 3306, QT application is able to connect.
Not getting where the things are going wrong. I have used below code of QT.
Code:
QJsonObject jo = getConnectionDetails(); // getConnectionDetails has all values of actual connections.
db.setHostName(jo.value("hostname").toString());
db.setDatabaseName(jo.value("dbname").toString());
db.setUserName(jo.value("username").toString());
db.setPassword(jo.value("password").toString());
db.setPort(jo.value("port").toInt());
if (!db.open()){
error = db.lastError().databaseText();
qDebug() << "Connection error: " + error;
return false;
}
return true;
Above code is part of connector function.
Please suggest why this happening?
Cheers
Manish
Re: QT mysql connectivity issue on other than default port
Wouldn't it be easier to answer the questions in the other forum before posting it here where due to the lack of the answers the same questions arise?