I Can't load the QMySQL with Qt 6 C++
-

At the first time after make the mingw32-make and install, The QMYSQL still doesn't load. So I do with- Copy the sqldrivers plugins Directory in you Application Run Directory
- Copy the libmysql.dll And libmysqld.dll in Your Application Run Directory
- Copy the libmysql.dll And libmysqld.dll in bin Directory Of Your Qt MinGW Kit Installed Directory.
- Also Check The MySQL Database Connection Parameter.
The QMYSQL add in available drivers. But it doesn't load. Please check help me
-

At the first time after make the mingw32-make and install, The QMYSQL still doesn't load. So I do with- Copy the sqldrivers plugins Directory in you Application Run Directory
- Copy the libmysql.dll And libmysqld.dll in Your Application Run Directory
- Copy the libmysql.dll And libmysqld.dll in bin Directory Of Your Qt MinGW Kit Installed Directory.
- Also Check The MySQL Database Connection Parameter.
The QMYSQL add in available drivers. But it doesn't load. Please check help me
- Set environment variable
QT_DEBUG_PLUGINS=1in case better diagnostic information. - Purely at a guess, is the QMYSQL plugin built so it can be linked by your compiler/linker (e.g. it is not MSVC or a different bit-ness)?
- Verify whether there are further DLLs which might need copying, perhaps extra dependencies --- use a dependency walker on the top-level QMYSQL DLL.
- See whether it works if you compile for release.
- Verify temporarily whether the QSQLITE does load.
-
@JonB
After add the QT_DEBUG_PLUGINS=1 The cmd show this and i see that QMYSQL is same with another sql. So I don't know @@
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE")
qt.core.plugin.factoryloader: looking at "qsqlmimer.dll"
qt.core.plugin.loader: Found metadata in lib C:/Qt/6.8.3/mingw_64/plugins/sqldrivers/qsqlmimer.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QMIMER"
]
},
"archlevel": 2,
"className": "QMimerSQLDriverPlugin",
"debug": false,
"version": 395264
}qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMIMER")
qt.core.plugin.factoryloader: looking at "qsqlmysql.dll"
qt.core.plugin.loader: Found metadata in lib C:/Qt/6.8.3/mingw_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QMYSQL",
"QMARIADB"
]
},
"archlevel": 2,
"className": "QMYSQLDriverPlugin",
"debug": false,
"version": 395264
}qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMYSQL", "QMARIADB")
qt.core.plugin.factoryloader: looking at "qsqlodbc.dll"
qt.core.plugin.loader: Found metadata in lib C:/Qt/6.8.3/mingw_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QODBC"
]
},
"archlevel": 2,
"className": "QODBCDriverPlugin",
"debug": false,
"version": 395264
}qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QODBC")
qt.core.plugin.factoryloader: looking at "qsqlpsql.dll" -
@JonB
After add the QT_DEBUG_PLUGINS=1 The cmd show this and i see that QMYSQL is same with another sql. So I don't know @@
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE")
qt.core.plugin.factoryloader: looking at "qsqlmimer.dll"
qt.core.plugin.loader: Found metadata in lib C:/Qt/6.8.3/mingw_64/plugins/sqldrivers/qsqlmimer.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QMIMER"
]
},
"archlevel": 2,
"className": "QMimerSQLDriverPlugin",
"debug": false,
"version": 395264
}qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMIMER")
qt.core.plugin.factoryloader: looking at "qsqlmysql.dll"
qt.core.plugin.loader: Found metadata in lib C:/Qt/6.8.3/mingw_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QMYSQL",
"QMARIADB"
]
},
"archlevel": 2,
"className": "QMYSQLDriverPlugin",
"debug": false,
"version": 395264
}qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMYSQL", "QMARIADB")
qt.core.plugin.factoryloader: looking at "qsqlodbc.dll"
qt.core.plugin.loader: Found metadata in lib C:/Qt/6.8.3/mingw_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QODBC"
]
},
"archlevel": 2,
"className": "QODBCDriverPlugin",
"debug": false,
"version": 395264
}qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QODBC")
qt.core.plugin.factoryloader: looking at "qsqlpsql.dll"@Tuanhoc8 This is not what you should be looking for. These are information that tells you these plugins exist. But we already know that from your "available drivers" output.
Find something like "loaded" or "cannot load" / “failed”.By the way, where is your libmysql.dll coming from? (You don't need to have libmysqld.dll though)
If you get it from MySQL Server, I remember it depends on libopenssl so it needs libcrypto-3-x64.dll and libssl-3-x64.dll to load. You may use Dependencies tool to check that.
(I highly recommend to build the plugin using the library from MariaDB instead of MySQL Server because it depends the least.)