Error QMYSQL Plugin on Windows
-
@SGaist Let me understand.
First of all, do you mean I have to add that path "C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib" or this path "C:\Program Files\MySQL\MySQL Server 8.0\lib"
Second of all, where do I have to add ? (see picture1 and picture2) ?
-
-
Then again, start your application with the QT_DEBUG_PLUGINS environment variable to see what is happening.
-
QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers" ... QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlite.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlite.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QSQLITE" ] }, "archreq": 0, "className": "QSQLiteDriverPlugin", "debug": false, "version": 330752 } "The plugin 'C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlite.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlited.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlited.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QSQLITE" ] }, "archreq": 1, "className": "QSQLiteDriverPlugin", "debug": true, "version": 330752 } Got keys from plugin meta data ("QSQLITE") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysql.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysql.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QMYSQL3", "QMYSQL" ] }, "archreq": 0, "className": "QMYSQLDriverPlugin", "debug": false, "version": 330752 } "The plugin 'C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysqld.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysqld.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QMYSQL3", "QMYSQL" ] }, "archreq": 1, "className": "QMYSQLDriverPlugin", "debug": true, "version": 330752 } Got keys from plugin meta data ("QMYSQL3", "QMYSQL") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlodbc.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlodbc.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QODBC3", "QODBC" ] }, "archreq": 0, "className": "QODBCDriverPlugin", "debug": false, "version": 330752 } "The plugin 'C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlodbc.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlodbcd.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlodbcd.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QODBC3", "QODBC" ] }, "archreq": 1, "className": "QODBCDriverPlugin", "debug": true, "version": 330752 } Got keys from plugin meta data ("QODBC3", "QODBC") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlpsql.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlpsql.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QPSQL7", "QPSQL" ] }, "archreq": 0, "className": "QPSQLDriverPlugin", "debug": false, "version": 330752 } "The plugin 'C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlpsql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlpsqld.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlpsqld.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QPSQL7", "QPSQL" ] }, "archreq": 1, "className": "QPSQLDriverPlugin", "debug": true, "version": 330752 } Got keys from plugin meta data ("QPSQL7", "QPSQL") QFactoryLoader::QFactoryLoader() checking directory path "E:/Qt Creator/build-sql_console_test-Desktop_Qt_5_12_1_MinGW_64_bit-Debug/debug/sqldrivers" ... Cannot load library C:\Qt\Qt5.12.1\5.12.1\mingw73_64\plugins\sqldrivers\qsqlmysqld.dll: The specified module could not be found. QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysqld.dll" : "Cannot load library C:\\Qt\\Qt5.12.1\\5.12.1\\mingw73_64\\plugins\\sqldrivers\\qsqlmysqld.dll: The specified module could not be found." QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7 Database is Not Connected!
-
Looks like you only built the plugin for release and not for debug and you are running a debug build of your application.
-
Add -debug to the qmake call
-
@SGaist I've called the qmake in debug mode, run the code and again Database is Not Connected!
Then again, I have start the application with the QT_DEBUG_PLUGINS environment variable and I get the next messageQFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers" ... QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlite.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlite.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QSQLITE" ] }, "archreq": 0, "className": "QSQLiteDriverPlugin", "debug": false, "version": 330752 } "The plugin 'C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlite.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlited.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlited.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QSQLITE" ] }, "archreq": 1, "className": "QSQLiteDriverPlugin", "debug": true, "version": 330752 } Got keys from plugin meta data ("QSQLITE") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysql.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysql.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QMYSQL3", "QMYSQL" ] }, "archreq": 0, "className": "QMYSQLDriverPlugin", "debug": false, "version": 330752 } "The plugin 'C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysqld.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysqld.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QMYSQL3", "QMYSQL" ] }, "archreq": 1, "className": "QMYSQLDriverPlugin", "debug": true, "version": 330752 } Got keys from plugin meta data ("QMYSQL3", "QMYSQL") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlodbc.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlodbc.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QODBC3", "QODBC" ] }, "archreq": 0, "className": "QODBCDriverPlugin", "debug": false, "version": 330752 } "The plugin 'C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlodbc.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlodbcd.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlodbcd.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QODBC3", "QODBC" ] }, "archreq": 1, "className": "QODBCDriverPlugin", "debug": true, "version": 330752 } Got keys from plugin meta data ("QODBC3", "QODBC") QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlpsql.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlpsql.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QPSQL7", "QPSQL" ] }, "archreq": 0, "className": "QPSQLDriverPlugin", "debug": false, "version": 330752 } "The plugin 'C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlpsql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlpsqld.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlpsqld.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QPSQL7", "QPSQL" ] }, "archreq": 1, "className": "QPSQLDriverPlugin", "debug": true, "version": 330752 } Got keys from plugin meta data ("QPSQL7", "QPSQL") QFactoryLoader::QFactoryLoader() checking directory path "E:/Qt Creator/build-sql_console_test-Desktop_Qt_5_12_1_MinGW_64_bit-Debug/debug/sqldrivers" ... Cannot load library C:\Qt\Qt5.12.1\5.12.1\mingw73_64\plugins\sqldrivers\qsqlmysqld.dll: The specified module could not be found. QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysqld.dll" : "Cannot load library C:\\Qt\\Qt5.12.1\\5.12.1\\mingw73_64\\plugins\\sqldrivers\\qsqlmysqld.dll: The specified module could not be found." QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7 Database is Not Connected!
-
Cannot load library
C:\Qt\Qt5.12.1\5.12.1\mingw73_64\plugins\sqldrivers\qsqlmysqld.dll
: The specified module could not be found.Does the exact file specified by that path actually exist, or not? (Note that the file mentioned,
qsqlmysqld.dll
, has ad
just before the.
, presumably indicating it's a debug build; this is not the same as if it wereqsqlmysql.dll
.) -
To reduce the output, can you move out of that folder all .dll files that are not related to MySQL ?
-
@SGaist I removed the non-MySQL files
Here is the outputQFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers" ... QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysql.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysql.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QMYSQL3", "QMYSQL" ] }, "archreq": 0, "className": "QMYSQLDriverPlugin", "debug": false, "version": 330752 } "The plugin 'C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin QFactoryLoader::QFactoryLoader() looking at "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysqld.dll" Found metadata in lib C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysqld.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QMYSQL3", "QMYSQL" ] }, "archreq": 1, "className": "QMYSQLDriverPlugin", "debug": true, "version": 330752 } Got keys from plugin meta data ("QMYSQL3", "QMYSQL") QFactoryLoader::QFactoryLoader() checking directory path "E:/Qt Creator/build-sql_console_test-Desktop_Qt_5_12_1_MinGW_64_bit-Debug/debug/sqldrivers" ... Cannot load library C:\Qt\Qt5.12.1\5.12.1\mingw73_64\plugins\sqldrivers\qsqlmysqld.dll: The specified module could not be found. QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.12.1/5.12.1/mingw73_64/plugins/sqldrivers/qsqlmysqld.dll" : "Cannot load library C:\\Qt\\Qt5.12.1\\5.12.1\\mingw73_64\\plugins\\sqldrivers\\qsqlmysqld.dll: The specified module could not be found." QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QMYSQL QMYSQL3 Database is Not Connected!
Same file qsqlmysqld.dll
-
Where exactly are the dlls matching the library you used to build the plugin ?
-
@Stelian said in Error QMYSQL Plugin on Windows:
C:Program Files/MYSQL/MySQL Server 8.0/lib
Then that's the one you should be having in your PATH environment variable.
One other thing you can use is Dependency Walker. Use it on your Qt MySQL plugin. Check that it can find the MySQL dll.