Qt 无法连接MySQL数据库
1.缺少驱动qt_mysql_driver
- Qt 5.15及之后版本缺少mysql驱动:qsqlmysql.dll、qsqlmysqld.dll
下载对应版本驱动:https://github.com/thecodemonkey86/qt_mysql_driver/releases?page=2 - 拷贝至Qt安装路径下,例如
Qt5.15.2\5.15.2\msvc2019_64\plugins\sqldrivers
2.缺少mysql驱动
-
根据mysql版本下载对应mysql压缩包https://downloads.mysql.com/archives/community/
-
找到libmysql.dll、libmysqld.dll、libmysql.lib、libmysqld.lib
-
拷贝至Qt安装路径下,例如
Qt5.15.2\5.15.2\msvc2019_64\bin
获取更多Linux C/C++资料