Question

Hello there, I’ve downloaded and installed Qt 5.2 32 bit for android, my machine is windows 8 64bit, I also have visual studio 2012 installed, MySQL 5.6.16 32bit is installed.

I’m trying to connect to a MySQL database, but I always get this error

QSqlDatabse: QMYSQL driver not loaded QSqlDatabse: available drivers: QSQLIT QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

Here is my code

#include <QCoreApplication>
#include <QtSql>
#include <QtDebug>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    return a.exec();
}

I added the path C:\Program Files\MySQL\MySQL Server 5.6\lib to my PATH environment and to the path in the run panel in Qt Creator. I’ve known that in Qt 5.2 there is no need to build the driver, anyway I’v tried and built it but with no difference, I don’t know if the built process went well or no. Any suggestions please because I spent the last two days searching the net for a solution. Thanks.

Was it helpful?

Solution

the problem was that I downloaded the offline MySQL installer for windows(x86-32bit) the installer is 32bit, but the server combined with it was (5.6 64bit) looks like there is no 5.6 server 32bit so I installed the 5.5 32bit server instead and it worked.

thanks for the help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top