到官网下载mysql-connector-c++源码,下载选项记得要在Platform选择SourceCode再下载,不然会出现The source directory "***/mysql-connector-c++***/include" does not appear to contain CMakeLists.txt.的错误。
下载最新boost,然后运行./bootstrap.sh,然后照着提示做。
解压后到mysql-connector-c++目录运行cmake . ,也可以用cmake -L查看cmake相关默认选项,可以加-D修改选项。
cmake . -DBOOST_ROOT:STRING=/home/kitty/Downloads/boost_1_55_0 \
-DMYSQLCPPCONN_DYNLOAD_MYSQL_LIB:FILEPATH=/opt/mysql/lib/libmysqlclient_r.so \ -DMYSQL_CONFIG_EXECUTABLE:FILEPATH=/opt/mysql/bin/mysql_config \-DCMAKE_INSTALL_PREFIX:PATH=/opt/mysql-connector-c++/
然后运行make && make install