I can't connect to my SQL database using QSqlDatabase. My system is: Windows 11 Qt 6.9.0 llvm-mingw1706_64 MySql 8.0.41 running on a CentOs virtual machine.
I extract libmysql.dll, libmysql.lib and all .h files from mysqld installation file. Following the instruction from qt I compiled the mysql drivers and then I found qsqlmysql.dll in "C:/Qt/6.9.0/llvm-mingw_64/plugins/sqldrivers/"
Then I copied libmysql.dll in my progrma directory and set QT_DEBUG_PLUGINS=1.
QSqlDatabase.drivers() show that I have all drivers and qslmysql is loaded, but I still ha an error on QSqlDatabase open.
This is the application output:
qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.9.0/llvm-mingw_64/plugins/sqldrivers" ...
qt.core.plugin.factoryloader: looking at "qsqlibase.dll"
qt.core.plugin.loader: Found metadata in lib C:/Qt/6.9.0/llvm-mingw_64/plugins/sqldrivers/qsqlibase.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QIBASE"
]
},
"archlevel": 1,
"className": "QIBaseDriverPlugin",
"debug": false,
"version": 395520
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QIBASE")
qt.core.plugin.factoryloader: looking at "qsqlite.dll"
qt.core.plugin.loader: Found metadata in lib C:/Qt/6.9.0/llvm-mingw_64/plugins/sqldrivers/qsqlite.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QSQLITE"
]
},
"archlevel": 1,
"className": "QSQLiteDriverPlugin",
"debug": false,
"version": 395520
}
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.9.0/llvm-mingw_64/plugins/sqldrivers/qsqlmimer.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QMIMER"
]
},
"archlevel": 1,
"className": "QMimerSQLDriverPlugin",
"debug": false,
"version": 395520
}
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.9.0/llvm-mingw_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QMYSQL",
"QMARIADB"
]
},
"archlevel": 1,
"className": "QMYSQLDriverPlugin",
"debug": false,
"version": 395520
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMYSQL", "QMARIADB")
qt.core.plugin.factoryloader: looking at "qsqloci.dll"
qt.core.plugin.loader: Found metadata in lib C:/Qt/6.9.0/llvm-mingw_64/plugins/sqldrivers/qsqloci.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QOCI"
]
},
"archlevel": 1,
"className": "QOCIDriverPlugin",
"debug": false,
"version": 395520
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QOCI")
qt.core.plugin.factoryloader: looking at "qsqlodbc.dll"
qt.core.plugin.loader: Found metadata in lib C:/Qt/6.9.0/llvm-mingw_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QODBC"
]
},
"archlevel": 1,
"className": "QODBCDriverPlugin",
"debug": false,
"version": 395520
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QODBC")
qt.core.plugin.factoryloader: looking at "qsqlpsql.dll"
qt.core.plugin.loader: Found metadata in lib C:/Qt/6.9.0/llvm-mingw_64/plugins/sqldrivers/qsqlpsql.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QPSQL"
]
},
"archlevel": 1,
"className": "QPSQLDriverPlugin",
"debug": false,
"version": 395520
}
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QPSQL")
qt.core.plugin.factoryloader: checking directory path "C:/Users/00005197/OneDrive - ansaldoenergiagroup/Documenti/Lavori/C++/Catalog/build/Desktop_Qt_6_9_0_llvm_mingw_64_bit-Debug/debug/sqldrivers" ...
qt.core.library: "C:/Qt/6.9.0/llvm-mingw_64/plugins/sqldrivers/qsqlmysql.dll" loaded library
"C:/Qt/6.9.0/llvm-mingw_64/plugins/iconengines/qsvgicon.dll" unloaded library
"C:/Qt/6.9.0/llvm-mingw_64/plugins/platforms/qwindows.dll" unloaded library
"C:/Qt/6.9.0/llvm-mingw_64/plugins/sqldrivers/qsqlmysql.dll" unloaded library
"C:/Qt/6.9.0/llvm-mingw_64/plugins/styles/qmodernwindowsstyle.dll" unloaded library
15:10:19: C:\Users\00005197\OneDrive - ansaldoenergiagroup\Documenti\Lavori\C++\Catalog\build\Desktop_Qt_6_9_0_llvm_mingw_64_bit-Debug\debug\Catalog.exe exited with code 0
Can someone explain me what I've done wrong?
Thank you.enter code here