mysql开发之API

3 篇文章 0 订阅
1 篇文章 0 订阅

1 系统环境

centos7_x64

[root@localhost datas]# uname -a
Linux localhost.localdomain 3.10.0-514.16.1.el7.x86_64 #1 SMP Wed Apr 12 15:04:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost datas]# mysqladmin --version
mysqladmin  Ver 8.42 Distrib 5.6.31, for Linux on x86_64

参考网址(https://dev.mysql.com/doc/refman/5.6/en/connectors-apis.html

2 开发环境配置

1 安装配置connector/c++
connector/c++是一个mysql连接器,使用connector/c++可以更方便的开发c++与数据库交互的程序。
与MySQL C API(MySQL客户端库)相比,MySQL Connector / C ++为C ++用户提供了以下好处:
纯C ++的便利性,
不需要C函数调用,
支持JDBC 4.0,一个行业标准的API,
支持面向对象的编程范例,
减少开发时间,
在GPL许可下使用FLOSS许可证例外,
根据要求可以获得商业许可证。
安装先决条件:
https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-installation-source-prerequisites.html
You must use either a General Availability version of MySQL 5.7 (5.7.9 or higher) or Connector/C 6.1.8 or higher. Set the MYSQL_DIR CMake option appropriately at configuration time as necessary.

同时还相关解释:
https://dev.mysql.com/doc/connectors/en/connector-cpp-usage-notes.html
In general, Connector/C++ works with MySQL 5.0, but it is not completely supported. Some methods may not be available when connecting to MySQL 5.0. This is because the Information Schema is used to obtain the requested information. There are no plans to improve the support for 5.0 because the current GA version of MySQL Server is 5.6. Connector/C++ is primarily targeted at the MySQL Server GA version that is available on its release.

综合上面两部分说明,我的理解是connector/c++推荐配套的mysql版本为5.7.19或更高,对于低版本也可以用但是可能在使用过程中会报错。为了保险起见建议升级到mysql5.7.19及其以上(比如mysql5.7.20)。

下面首先要源码安装connector/c++,下载源码

git clone https://github.com/mysql/mysql-connector-cpp

相关安装过程如下:
https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-installation-source-unix.html

未完待续。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值