QT4 installation Please refer to: Installing QT 4 under CentOS 6.5
For MySQL installation Please refer to the following: CentOS 6.5 installation configuration MySQL
1. Prevention in case, first install the Mysql-devel (must be installed!) )。 If you do not install, there will be no problem with-lmysqlclient after compiling.
2. Start compiling:
CD $QTDIR/src/plugins/sqldrivers/mysql//Enter QT that store MySQL driver source directory "
Qmake "Includepath+=/usr/include/mysql" "Libs+=-l/usr/lib/mysql-lmysqlclient_r" Mysql.pro
In this sentence I modified the statement in the QT helper because my MySQL library was in/usr/include/mysql,/usr/lib/mysql.
Make//And make a bit
3. The final step
CD $QTDIR/src/plugins/sqldrivers/mysql//Enter that directory here too
Make install//build, it seems to have made the step above, but this step is to do a bit
4. Complete
You can find a newly generated libqsqlmysql.so in/qtsdk-2009.05/qt/plugins/sqldrivers, which is the MySQL driver.
CentOS 6.5 QT4 connect to MySQL Database