Prepare: Install VS2008 and Qt 4.8.2, and set environment variables (qtdir=c:\qt\4.8.2 and Path+=c:\qt\4.8.2\bin)
First, download the MySQL database, install (fully installed) to the C packing directory, set the environment variables, Path+=c:\mysql\bin.
"Start", "All Programs", "Microsoft Visual Studio," Visual Studio Tools, "Visual Studio 2008 Command Prompt", The C:\Qt\4.8.2\src\plugin\sqldrivers\mysql directory is made from the CD command at the command line.
Iii. input command: qmake-o Makefile includepath+= "C:\MySQL\include" libs+= "C:\MySQL\lib\opt\libmysql.lib" Mysql.pro
V. Input command: NMAKE.
VI. If successful, the MySQL driver file will be generated in the C:\Qt\4.8.2\plugins\sqldrivers directory.
Attention:
If you want to compile Qt4.8.2 64-bit MySQL driver with VS2008 compiler, first need to download Qt-everywhere-opensource-src-4.8.2.zip source code, extract to C:\Qt\4.8.2_ 64, and set the environment Qtdir and path,
Visual Studio Tools, "Start", "All Programs", "Visual Studio x64 Win64 command Prompt", Microsoft Visual Studio Compiles a 64-bit version of QT. then download and install
64-bit MySQL, finally compiled 64-bit MySQL driver.
Compiling Qt4.8.2 mysql driver using the VS2008 compiler