Reputation: 265
Same "QMYSQL driver not loaded" error.
But others people see the QMYSQL in the "QSqlDatabase: available drivers" message.
Why I don't even have it?
Upvotes: 0
Views: 2591
Reputation: 116
The first thing is to download the connector installer, depending on the version of the compiler you are using, 64 or 32 bits, for c from here: https://downloads.mysql.com/archives/c-c/
locate the connector installation folder and run these commands.
cd% QTDIR% \ qtbase \ src \ plugins \ sqldrivers
qmake - MYSQL_INCDIR = "C: / Program Files / MySQL / MySQL Connector C 6.1 / include" MYSQL_LIBDIR = "C: / Program Files / MySQL / MySQL Connector C 6.1 / lib"
mingw32-make
mingw32-make install
Here you can see the official Qt documentation. https://doc.qt.io/qt-5/sql-driver.html#qmysql
and with that you would have everything ready, good luck.
note. don't forget to include the sql module in your .pro file.
Upvotes: 2