I know there are already many topics on this forum about this problem but I did not manage to solve mine following them.
My configuration is the following:
QT Version : 5.14.2 - mscv2017_64
Compiler: mscv amd64
My problem is that my application does not load the libmysql.dll. Here is what I have done:
I opened the command line MSCV 2017 64bits provided by qt and I initialized my environment using vcvarsall.bat amd64
.
Then I have built the sql driver as explained in the documentation.
Here is the result of the qmake call:
Then, ran nmake
and nmake install
and in the folder C:\Qt\5.14.2\msvc2017_64\plugins\sqldrivers
, I found the following files.
Then I added libmysql.dll
in the folder where my the exe file of my application was created. I got this file from the mysql server installation folder C:\Program Files\MySQL\MySQL Server 8.0\lib
.
Then I rebuilt my application, but I still have the same error appearing, saying that the driver was not loaded. I compiled using the QT_DEBUG_PLUGINS=1
flag and I got as an output:
"The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Thomas Bouchan/Documents/Personal/C++/SSVP/build-SSVP-project-Desktop_Qt_5_14_2_MSVC2017_64bit-Release/release/sqldrivers" ... Cannot load library C:\Qt\5.14.2\msvc2017_64\plugins\sqldrivers\qsqlmysql.dll: The specified module could not be found. QLibraryPrivate::loadPlugin failed on "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlmysql.dll" : "Cannot load library C:\Qt\5.14.2\msvc2017_64\plugins\sqldrivers\qsqlmysql.dll: The specified module could not be found." QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7"
From this I don't know what to do, as in the specified folder, the dll is there... Is it a question of 64 or 32 bits? Shall I build the driver with another compiler (not amd64
?)?
qsqlmysql.dll
in dependency walker? – king_nak