The QtSDK contains the QtCreator and Qt basic libraries and is a very good development environment. However, In the plugins of the Qt base library in the installation package, the database driver is only sqlite, not
The Qt SDK contains the QtCreator and Qt base libraries and is a very good development environment. However, In the plugins of the Qt base library in the installation package, the database driver is only sqlite, not
The Qt SDK contains QtCreator and Qt basic libraries and is a very good development environment. However, the database driver in the plugins of the Qt base library in this installation package is only sqlite and does not contain the MySQL driver. MySQL is a very common database platform.
If you need a MySQL driver, follow these steps:
To the next Qt source package of Trolltech, which contains the MySQL-driven source program. Before compiling the MySQL driver, make sure that you have installed the complete MySQL database, including mysql-devel, which is required by the compilation driver.
The following uses my machine environment as an example.
Tar-zxvf qt-x11-opensource-src-4.5.1.tar.gz
Cd qt-x11-opensource-src-4.5.1/src/plugins/sqldrivers/mysql
Qmake-qt4 "INCLUDEPATH + =/usr/include/mysql" "LIBS + =-L/usr/lib/mysql-lmysqlclient_r" mysql. pro
Make
After the execution is complete, a file libqsqlmysql. so will be added to the path of the operation, which is the mysql driver of qt. Copy it to the corresponding Qt location of the Qt SDK, in my machine it is in/home/pub/qtsdk-2009.02/qt/plugins/sqldrivers.
Note:
1. The Qt source package version must be the same as the Qt version in the Qt SDK. Otherwise, the newly compiled driver system does not recognize the version.
2. During compilation, include and libs must specify the path to the MySQL header and library.