CentOS 6.5 QT4 connect to MySQL Database

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.