Answer the question
In order to leave comments, you need to log in
How to connect Qt applications to mySql database?
You need to create a connection in the application to the database located on the site.
I'm trying to do this:
bool ControllerSQL::CreateConnection()
{
Info = QSqlDatabase::addDatabase("QMYSQL");
Info.setHostName("f63216y7.beget.tech");
Info.setDatabaseName("f63216y7_water");
Info.setUserName("f63216y7_water");
Info.setPassword("12341234");
if(Info.open())
return true;
qDebug()<<Info.lastError().text();
return false;
}
Answer the question
In order to leave comments, you need to log in
Can you connect to this database with any other sql client from your computer?
Looks like the database on the site just doesn't allow remote connections.
And also - it is necessary to rebuild the mysql plugin.
According to the instructions in the manual:
cd %QTDIR%\qtbase\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:/MYSQL/MySQL Server <version>/lib/opt/libmysql.lib" mysql.pro
nmake
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question