提示Driver not loaded,连接远程的数据库还要装MySQL吗?网上说要编译MySQL驱动,难道Qt不自带吗
[解决办法] 是要自己编译驱动,文档里有的: How to Build the QMYSQL Plugin on Windows
You need to get the MySQL installation files. Run SETUP.EXE and choose "Custom Install". Install the "Libs & Include Files" Module. Build the plugin as follows (here it is assumed that MySQL is installed in C:\MySQL):
cd %QTDIR%\src\plugins\sqldrivers\mysql qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server <version>\lib\opt\libmysql.lib" mysql.pro nmake If you are not using a Microsoft compiler, replace nmake with make in the line above.
Note: This database plugin is not supported for Windows CE.
Note: Including "-o Makefile" as an argument to qmake to tell it where to build the makefile can cause the plugin to be built in release mode only. If you are expecting a debug version to be built as well, don't use the "-o Makefile" option. [解决办法]