1.将版本号下的bin目录路径拷贝至环境变量中
2.E:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers\mysql
进入上述路径找到mysql.pro文件打开,做如下修改
TARGET = qsqlmysql
HEADERS += $$PWD/qsql_mysql_p.h
SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
#QMAKE_USE += mysql
OTHER_FILES += mysql.json
PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
win32:LIBS += -LE:\mysql-8.0.24-winx64\lib -llibmysql
INCLUDEPATH += E:\mysql-8.0.24-winx64\include
DEPENDPATH += E:\mysql-8.0.24-winx64\include
include(../qsqldriverbase.pri)
3.编译文件,在qt同一目录下生成一个plugin文件夹
4.拷贝文件
拷贝到此处E:\Qt\5.14.2\mingw73_64\