I have compiled the QT MySQL driver in http://download.csdn.net/source/2794174
The compilation process is as follows:
First install QT creator. the version I used is 2010.05 and has been integrated with mingw32.
1. Download and install MySQL SDK, http://www.mysql.com/downloads/connector/cpp/
2. Create the C:/MySQL/mysql51 directory under drive C, and copy the include and Lib directories under C:/program files/MySQL connector C 6.0.2.
3. Download a DEV-CPP and add C:/dev-CPP/bin to the path of the system environment variable.
4. Download the dynamic library format conversion tool http://www.qtcn.org/download/mingw-utils-0.3.tar.gz
Decompress reimp.exe to the dev-CPP/bin directory.
5. run cd c:/MySQL/mysql51/opt/In the CMD command line to enter the MySQL library directory and run reimp-D libmysql. lib converts it to libmysql. def, and then run dlltool-K-D libmysql. def-l libmysql. A
6. Click the "Start" button in the lower left corner of the screen to go to "qt sdk by Nokia v2010.05 (Open Source)", select "QT command promptworkflow", enter the command line with qt, and execute configure.exe
-Debug-and-release-platform win32-g ++-QT-SQL-mysql-l mysql-I
C:/MySQL/mysql51/include-l c:/MySQL/mysql51/lib/OPT, which is a long wait ...,
Then execute the mingw32-make sub-src, and then it's a longer wait...
7. after completion, enter C:/Qt/2010.05/qt/src/plugins/sqldrivers/mysql, and enter qmake-o Makefile "INCLUDEPATH + = C: /MYSQL/MYSQL51/INCLUDE "" LIBS + = C:/MYSQL/MYSQL51/LIB/OPT/LIBMYSQL. a "mysql. pro
8. Input mingw32-make
9. After compilation is complete, there will be more in C:/Qt/2010.05/qt/plugins/sqldrivers/
- Libqsqlmysql4.a
- Libqsqlmysqld4.a
- Qsqlmysql4.dll
- Qsqlmysqld4.dll
Compilation is successful. In addition, the C:/MySQL/MySQL51/lib/opt/libmysql. dll file must be copied under c:/qt/2010.05/qt/bin. Then you can write the qt program to connect to mysql, but there is also a problem at this time, that is, the compilation will report an error and mysql cannot be found. h. I used to copy all the files in c:/mysql/mysql51/include to C:/Qt/2010.05/qt/include/QtSql.
Reference: http://student.csdn.net/space.php? Uid = 32341 & do = blog & id = 10663