MySQL - MySQL接口设计之mysql-connector-c源码安装
Posted 白驹过隙
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL - MySQL接口设计之mysql-connector-c源码安装相关的知识,希望对你有一定的参考价值。
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:
Change location to the top-level directory of the source distribution.
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 theCMAKE_INSTALL_PREFIX
option to specify a different directory when generating theMakefile
. 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.
Build the project:
shell>make
As
root
, install the Connector/C headers, libraries, and utilities:
root-shell>
make install
执行完一系列cmake后将产生makefile文件
注意将第二步中的install目录设置到自己的文件路径下
以上是关于MySQL - MySQL接口设计之mysql-connector-c源码安装的主要内容,如果未能解决你的问题,请参考以下文章