In How to solve “QSqlDatabase: QMYSQL driver not loaded”, this answer says that libqsqlmysql.a and libqsqlmysqld.a files should exist in <QtDir>\mingw73_xx\lib
folder.
But I cannot get libqsqlmysql.a and libqsqlmysqld.a of any place such as GitHub. I only found libqsqlmysql.dll and libqsqlmysqld.dll files.
Code:
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setDatabaseName("C:/ProgramData/MySQL/MySQL Server 8.0/Data/world/city.idb");
db.setHostName("localhost");
db.setUserName("root");
db.setPassword("1234567890");
The output:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QODBC QPSQL
The instructions to build the driver should be similar to this: https://stackoverflow.com/questions/61996316/how-to-build-the-mysql-plugin-for-qt-using-mysql-server-8-0
why QMYSQL driver not loaded but the available drivers have QMYSQL ,…….
You probably downloaded drivers that are not compatible with your installed Qt
my qt ver is 6.5.2. and my mysql ver is 8.0.35 but i dont know where is the qmysql driver is better to download
wen download 6.5.2 the output is QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QODBC QPSQL but wen download 6.6.1 output is to with out QMYSQL
Show 1 more comment