关闭

Centos7下编译Qt的mysql驱动

361人阅读 评论(0) 收藏 举报
分类:

Centos7下编译Qt的mysql驱动

MySql开发环境配置

[root@localhost ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.41-2.el7_0.x86_64
[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.41-2.el7_0.x86_64
[root@localhost ~]# rpm -qa | grep mariadb

因为我自己的机器是64位的,所以我安装的是mysql-community-devel.x86_64。

[root@localhost ~]# yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
已加载插件:fastestmirror, langpacks
mysql-community-release-el7-5.noarch.rpm                                                                    | 6.0 kB  00:00:00
.............
已安装:
  mysql-community-release.noarch 0:el7-5                                                                                           

完毕!
[root@localhost ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64        MySQL Connectors Community           14
mysql-tools-community/x86_64             MySQL Tools Community                19
mysql56-community/x86_64                 MySQL 5.6 Community Server          154
[root@localhost ~]# yum install mysql-community-devel.
mysql-community-devel.i686    mysql-community-devel.x86_64  
[root@localhost ~]# yum install mysql-community-devel.x86_64 
已加载插件:fastestmirror, langpacks
作为依赖被安装:
  mysql-community-common.x86_64 0:5.6.25-2.el7                      mysql-community-libs.x86_64 0:5.6.25-2.el7                     

完毕!
[root@localhost ~]# rpm -qa | grep mysql
mysql-community-libs-5.6.25-2.el7.x86_64
mysql-community-release-el7-5.noarch
mysql-community-common-5.6.25-2.el7.x86_64
mysql-community-devel-5.6.25-2.el7.x86_64
[root@localhost ~]# locate mysql
locate: 无法执行 stat () `/var/lib/mlocate/mlocate.db': 没有那个文件或目录
[root@localhost ~]# updatedb
[root@localhost ~]# locate mysql
/etc/ld.so.conf.d/mysql-x86_64.conf
/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
/etc/selinux/targeted/modules/active/modules/mysql.pp
.............
/usr/include/mysql
.............
/usr/lib64/mysql
/usr/lib64/mysql/libmysqlclient.a
/usr/lib64/mysql/libmysqlclient.so
/usr/lib64/mysql/libmysqlclient.so.18
/usr/lib64/mysql/libmysqlclient.so.18.1.0
/usr/lib64/mysql/libmysqlclient_r.a
/usr/lib64/mysql/libmysqlclient_r.so
/usr/lib64/mysql/libmysqlclient_r.so.18
/usr/lib64/mysql/libmysqlclient_r.so.18.1.0
/usr/lib64/mysql/libmysqlservices.a
  • MariaDB
[root@localhost ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.41-2.el7_0.x86_64
[root@localhost ~]# yum install mariadb
mariadb-bench.x86_64           mariadb-embedded-devel.i686    mariadb-embedded.x86_64        mariadb-test.x86_64
mariadb-devel.i686             mariadb-embedded-devel.x86_64  mariadb-libs.i686              mariadb.x86_64
mariadb-devel.x86_64           mariadb-embedded.i686          mariadb-server.x86_64          
[root@localhost ~]# yum install mariadb-devel.x86_64 
已加载插件:fastestmirror, langpacks
作为依赖被升级:
  openssl.x86_64 1:1.0.1e-42.el7.9                              openssl-libs.x86_64 1:1.0.1e-42.el7.9                             

完毕!
[root@localhost ~]# locate mysql
locate: 无法执行 stat () `/var/lib/mlocate/mlocate.db': 没有那个文件或目录
[root@localhost ~]# updatedb
[root@localhost ~]# locate mysql
/etc/alternatives/mysql_config
/etc/my.cnf.d/mysql-clients.cnf
.............
/usr/include/mysql
.............
/usr/lib64/mysql
/usr/lib64/mysql/libmysqlclient.so
/usr/lib64/mysql/libmysqlclient.so.18
/usr/lib64/mysql/libmysqlclient.so.18.0.0
/usr/lib64/mysql/libmysqlclient_r.so
.............

sqldriver编译

安装qt-opensource-linux-x64-5.3.0.run,添加环境变量(在最后一行加入export PATH=.:/opt/Qt5.3.0/Tools/QtCreator/bin:/opt/Qt5.3.0/5.3/gcc_64/bin:$PATH)。

[root@localhost ~]# vim /etc/profile
[root@localhost ~]# source /etc/profile

将qt-everywhere-opensource-src-5.3.0整个文件夹拷到机器中,切换到qt-everywhere-opensource-src-5.3.0/qtbase/src/plugins/sqldrivers/mysql/下面编译

[root@localhost ~]# cd qt-everywhere-opensource-src-5.3.0/qtbase/src/plugins/sqldrivers/mysql/
[root@localhost mysql]# qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib64/mysql -lmysqlclient_r" ./mysql.pro
[root@localhost mysql]# make
[root@localhost mysql]# make install
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:900次
    • 积分:81
    • 等级:
    • 排名:千里之外
    • 原创:2篇
    • 转载:0篇
    • 译文:0篇
    • 评论:0条
    文章分类
    文章存档