I am using Ubuntu and I have Qt offline which is installed from an offline installer.
While connecting to MySQL database I have got an error
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QSQLITE2
QSqlError(-1, "Driver not loaded", "Driver not loaded")
Failed to connect.
The program has unexpectedly finished.
now I tried this code
#include <QCoreApplication>
#include <QSqlDatabase>
#include <QStringList>
#include <QtDebug>
int main( int argc, char **argv )
{
QCoreApplication app( argc, argv );
qDebug() << QSqlDatabase::drivers();
}
and got output
("QSQLITE", "QSQLITE2")
then how to connect my Qt to MySQL database?
I successfully connected to sqlite database.
in ubuntu there some configurations for offline installer.you can easily connect to mysql by installing qt from ubuntu repository.the important thing is that,the offline installer have 1gb size.but the packages downloaded from ubuntu repository have a size less than 200 mb.