I had complied qsqlmysql.dll.
-
@yuyu said in I had complied qsqlmysql.dll.:
help me , I am crazying.
Why not using the search function? It's a very powerful thing...
-
I do not find the answer, I used qt6.3.
-
You should post the whole output of QT_DEBUG_PLUGINS and make sure (as in all other threads you will find here) that the dependencies of the plugin (= mysql dlls) are found - so that they're either in the path or parallel to the plugin.
-
@yuyu As @Christian-Ehrlicher suggested set QT_DEBUG_PLUGINS environment variable to 1 before running your app and then check its out put - it should tell you why qsqlmysql.dll could not be loaded.
-
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE") qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QMYSQL", "QMARIADB" ] }, "archlevel": 2, "className": "QMYSQLDriverPlugin", "debug": true, "version": 393984 } qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" : "Cannot load library C:\\Qt\\6.3.0\\mingw_64\\plugins\\sqldrivers\\qsqlmysql.dll
I had success when i use mysql5.7 ,but the same way there has error when i use mysql8.0.22
-
@yuyu said in I had complied qsqlmysql.dll.:
qsqlmysql.dll
In your other output there is some unreadable characters after qsqlmysql.dll:
Can you provide that part as readable text? -
@jsulm the unreadable characters is what I use qDebug output chineses,I had delete it.
now
mycodeqDebug() << QSqlDatabase::drivers(); QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); db.setHostName("localhost"); db.setPort(3306); db.setDatabaseName("mydb"); db.setUserName("root"); db.setPassword("123456"); bool ok = db.open();
the console
16:45:13: Debugging D:\1a_perfect\build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug\debug\testsql.exe ... qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/platforms" ... qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/platforms/qdirect2d.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/platforms/qdirect2d.dll, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "direct2d" ] }, "archlevel": 2, "className": "QWindowsDirect2DIntegrationPlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("direct2d") qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/platforms/qminimal.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/platforms/qminimal.dll, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "minimal" ] }, "archlevel": 2, "className": "QMinimalIntegrationPlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimal") qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/platforms/qoffscreen.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/platforms/qoffscreen.dll, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "offscreen" ] }, "archlevel": 2, "className": "QOffscreenIntegrationPlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("offscreen") qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/platforms/qwindows.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/platforms/qwindows.dll, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "windows" ] }, "archlevel": 2, "className": "QWindowsIntegrationPlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("windows") qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/platforms" ... qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/platforms/qwindows.dll" loaded library qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/platformthemes" ... qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/platformthemes" ... qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/styles" ... qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/styles/qwindowsvistastyle.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/styles/qwindowsvistastyle.dll, metadata= { "IID": "org.qt-project.Qt.QStyleFactoryInterface", "MetaData": { "Keys": [ "windowsvista" ] }, "archlevel": 2, "className": "QWindowsVistaStylePlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("windowsvista") qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/styles" ... qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/styles/qwindowsvistastyle.dll" loaded library qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/iconengines" ... qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/iconengines/qsvgicon.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/iconengines/qsvgicon.dll, metadata= { "IID": "org.qt-project.Qt.QIconEngineFactoryInterface", "MetaData": { "Keys": [ "svg", "svgz", "svg.gz" ] }, "archlevel": 2, "className": "QSvgIconPlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("svg", "svgz", "svg.gz") qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/iconengines" ... qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/imageformats" ... qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qgif.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/imageformats/qgif.dll, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "gif" ], "MimeTypes": [ "image/gif" ] }, "archlevel": 2, "className": "QGifPlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("gif") qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qico.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/imageformats/qico.dll, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "ico", "cur" ], "MimeTypes": [ "image/vnd.microsoft.icon", "image/vnd.microsoft.icon" ] }, "archlevel": 2, "className": "QICOPlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("ico", "cur") qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qjpeg.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/imageformats/qjpeg.dll, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "jpg", "jpeg" ], "MimeTypes": [ "image/jpeg", "image/jpeg" ] }, "archlevel": 2, "className": "QJpegPlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("jpg", "jpeg") qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qsvg.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/imageformats/qsvg.dll, metadata= { "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface", "MetaData": { "Keys": [ "svg", "svgz" ], "MimeTypes": [ "image/svg+xml", "image/svg+xml-compressed" ] }, "archlevel": 2, "className": "QSvgPlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("svg", "svgz") qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/imageformats" ... qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qgif.dll" loaded library qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qico.dll" loaded library qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qjpeg.dll" loaded library qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qsvg.dll" loaded library qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers" ... qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlite.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlite.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QSQLITE" ] }, "archlevel": 2, "className": "QSQLiteDriverPlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE") qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QMYSQL", "QMARIADB" ] }, "archlevel": 2, "className": "QMYSQLDriverPlugin", "debug": true, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMYSQL", "QMARIADB") qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlodbc.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlodbc.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QODBC" ] }, "archlevel": 2, "className": "QODBCDriverPlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QODBC") qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlpsql.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlpsql.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QPSQL" ] }, "archlevel": 2, "className": "QPSQLDriverPlugin", "debug": false, "version": 393984 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QPSQL") qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/sqldrivers" ... QList("QSQLITE", "QMARIADB", "QMYSQL", "QODBC", "QPSQL") qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" loaded library qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/accessible" ... qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/accessible" ... qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/accessiblebridge" ... qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/accessiblebridge" ...
-
@yuyu said in I had complied qsqlmysql.dll.:
qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" loaded library
Looks good now
-
@yuyu What does db.open() return?
What does https://doc.qt.io/qt-5/qsqldatabase.html#lastError return after open() call? -
@Nevez yes,but I had install it. it return false.
sometime has
qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" : "Cannot load library C:\\Qt\\6.3.0\\mingw_64\\plugins\\sqldrivers\\qsqlmysql.dll:
-
@yuyu I'm confused: before you posted output showing that the plug-in was loaded.
Now you posted output showing that it could not be loaded.Please do again what was suggested before: set QT_DEBUG_PLUGINS and if the plug-in fails to load post the output here...