Qt4 is connected to the mysql running platform: win7 Compiler: vc IDE: vs2010 MYSQL: 5.5. If you forget it, you can leave it for others' reference. The dll and lib corresponding to www.2cto.com mysql are qsqlmysqld4.dll and qsqlmysqld4.lib. This is compiled. 1) first go to the cd % QTDIR % \ src \ plugins \ sqldrivers \ mysql directory, 2) run the command qmake-o Makefile "INCLUDEPATH + = C: \ MySQL \ include "" LIBS + = C: \ MySQL \ lib \ opt \ libmysql. lib "mysql. pro. Here, C: \ MySQL is the installation directory of mysql. There is no space in it. If there is a space, it cannot be compiled. At this time, you must copy the include and lib files in the mysql installation directory to another directory without spaces. For example, I copied them to D: \ work, then the above command becomes www.2cto.com qmake-o Makefile "INCLUDEPATH + = D: \ work \ include" "LIBS + = D: \ work \ lib \ libmysql. lib "mysql. pro 3) Run nmake. The required files qsqlmysqld4.dll and qsqlmysqld4.lib 4 are displayed under % QTDIR % \ src \ plugins \ sqldrivers \ mysql \ debug) copy the two files to % QTDIR % \ plugins \ sqldrivers.