qt 5.8 sql 连接错误:QMYSQL 驱动程序未在 Windows 10 上加载

2021-12-09 00:00:00 qt mysql c++

当我尝试连接到mysql时,出现错误:

When i tried to connect to mysql, there is a error:

QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
"Driver not loaded Driver not loaded"

所以我用谷歌搜索了它,然后我尝试了:

So i googled it, and i tried :

1.将sqldrivers文件夹复制到C:QtQt5.8.05.8mingw53_32plugins

1.Copy sqldrivers folders to C:QtQt5.8.05.8mingw53_32plugins

2.将 libmysql.dll 复制到 C:QtQt5.8.05.8mingw53_32in

2.Copy libmysql.dll to C:QtQt5.8.05.8mingw53_32in

但错误仍然存​​在.

有什么我遗漏的吗?

推荐答案

libmysql.dll 有 64 位和 32 位版本.重建 Qt 驱动程序不是必须.

There are 64 bit and 32 bit versions of libmysql.dll. rebuilding the Qt Driver is NOT a must.

Qt5.9.1 的预编译版本,你仍然需要使用 32 位版本,它甚至可以与 64 版本的 MySQL 安装一起使用.无需任何 QT 插件或组件的重建.在此处下载 32 位 MySQL 连接器

With the prebuilt version of Qt5.9.1, you still need to use the 32 bit version, it worked even with the 64 version of MySQL installation. without any rebuild of QT plugins or components. Download 32 bit MySQL connector here

这里已经回答了:medasumanth 答案

相关文章