码迷,mamicode.com
首页 > 数据库 > 详细

MySQL - MySQL接口设计之mysql-connector-c源码安装

时间:2016-08-27 20:42:32      阅读:892      评论:0      收藏:0      [点我收藏+]

标签:

mysql官网提供了各类mysqlclient,提供开发者使用进行mysql接口开发,其中linux版本根据分支和分支版本提供了各不相同的包。

由于我的是ubuntu 16.04的最新版本,并没有找到相对应的开发包,而且考虑到后续版本升级和移植问题,还是采用源码包的方式最为可靠。

但是源码包并没有提供安装说明,找了半天在官网找到了安装教程。

4.2.1 Installing Connector/C from Source on Unix and Unix-Like Systems

If the native compiler toolset for the target platform is available (for example, SunStudio for Solaris), you can use that for compilation. Alternatively, the GNU toolset can be used on all platforms.

You also need CMake 2.6 or newer, which is available from cmake.org.

To build and install the source distribution, use the following procedure:

  1. Change location to the top-level directory of the source distribution.

  2. Generate the Makefile:

    shell> cmake -G "Unix Makefiles"
    

    Or, for a Debug build:

    shell> cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
    

    By default, the installation location for Connector/C is /usr/local/mysql. To change this location, use the CMAKE_INSTALL_PREFIX option to specify a different directory when generating the Makefile. For example:

    shell> cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/opt/local/mysql
    

    For other CMake options that you might find useful, see Other Connector/C Build Options.

     

  3. Build the project:

    shell> make
    

     

  4. As root, install the Connector/C headers, libraries, and utilities:

     

     

    root-shell> make install

执行完一系列cmake后将产生makefile文件

注意将第二步中的install目录设置到自己的文件路径下

MySQL - MySQL接口设计之mysql-connector-c源码安装

标签:

原文地址:http://www.cnblogs.com/binchen-china/p/5813638.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!