To obtain a Connector/C++ source distribution, visit theConnector/C++ downloads page. Alternatively, clone the Connector/C++ Git source repository.
A Connector/C++ source distribution is packaged as a compressedtarfile or Zip archive, denoted here as
orPACKAGE
.tar.gz
. A source distribution intarfile or Zip archive format can be used on any supported platform.PACKAGE
.zip
The distribution when unpacked includes anINFO_SRC
file that provides information about the product version and the source repository from which the distribution was produced. The distribution also includes other documentation files such as those listed inChapter 3,Installing Connector/C++ from a Binary Distribution.
To unpack a compressedtarfile, use this command in the intended installation directory:
tar zxvfPACKAGE.tar.gz
After unpacking the distribution, build it using the appropriate instructions for your platform later in this chapter.
To install from a Zip archive package (.zip
file), useWinZipor another tool that can read.zip
files to unpack the file into the location of your choosing. After unpacking the distribution, build it using the appropriate instructions for your platform later in this chapter.
To clone the Connector/C++ code from the source code repository located on GitHub athttps://github.com/mysql/mysql-connector-cpp, use this command:
git clone https://github.com/mysql/mysql-connector-cpp.git
该命令应该创建amysql-connector-cpp
directory containing a copy of the entire Connector/C++ source tree.
Thegit clonecommand sets the sources to themaster
branch, which is the branch that contains the latest sources. Released code is in the8.0
branche (the8.0
branch contains the same sources as themaster
branch). If necessary, usegit checkoutin the source directory to select the desired branch. For example, to build Connector/C++ 8.0:
cd mysql-connector-cpp git checkout 8.0
After cloning the repository, build it using the appropriate instructions for your platform later in this chapter.
After the initial checkout operation to get the source tree, rungit pullperiodically to update your source to the latest version.