Qt 5.8 SQL连接错误:Windows 10上未加载QMYSQL驱动程序 [英] qt 5.8 sql connection error:QMYSQL driver not loaded on windows 10
问题描述
当我尝试连接到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:\ Qt \ Qt5.8.0 \ 5.8 \ mingw53_32 \ plugins
1.Copy sqldrivers folders to C:\Qt\Qt5.8.0\5.8\mingw53_32\plugins
2.将libmysql.dll复制到C:\ Qt \ Qt5.8.0 \ 5.8 \ mingw53_32 \ bin
2.Copy libmysql.dll to C:\Qt\Qt5.8.0\5.8\mingw53_32\bin
但错误仍然存在.
我有什么想念的吗?
推荐答案
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答案
This was already answered here: medasumanth answer
这篇关于Qt 5.8 SQL连接错误:Windows 10上未加载QMYSQL驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!