Step 1: open a command prompt and run:
# C:/QT/2010.05/bin/qtenv. bat
Configure the environment variables. This is a temporary configuration. After CMD is disabled, it becomes invalid. Adding this step saves the trouble of environment variable configuration.
Step 2:
# Cd c:/QT/2010.05/QT/src/plugins/sqldrivers/MySQL
Switch to this directory and open the mysql. Pro file under this directory in a text editor.
Step 3:
Add the following to MySQL. Pro:
Export depath + = "C:/program files/MySQL Server 5.1/include"
Libs + = "C:/program files/MySQL Server 5.1/lib/opt/libmysql. lib"
Save and exit
Step 4:
# Qmake-O makefile mysql. Pro
Three warning messages are prompted, but the alarm is not affected.
Step 5:
# Mingw32-make
Compile the MySQL driver. It will soon be finished. It's easy enough.
Four files are added to C:/QT/2010.05/QT/plugins/sqldrivers:
Qsqlmysql4.dll
Libqsqlmysql4.a
Qsqlmysqld4.dll
Libqsqlmysqld4.a
Step 6: Find out how to use it.
Legend:
If not, copy C:/program files/MySQL Server 5.1/lib/opt/libmysql. DLL to the directory where the running program is located or system32.