cmake、Visual Studio编译“MySQL Community Server”、“MySQL Connector/C”、“MySQL Connector/C++”

熊朝
2023-12-01
开篇提示1:本文为本人原创,“第一个”解决“MySQL Connector/C++”编译所遇到的所有问题,如果找到2014年5月15日12:00之前解决该问题的文章请留言。
开篇提示2
:本文欢迎转载,但必须注明本文出处,例如:
“该文引用自 CruiseYoung的:cmake、Visual Studio编译“MySQL Community Server”、“MySQL Connector/C”、“MySQL Connector/C++”
http://blog.csdn.net/fksec/article/details/25872389”
否则说明阁下愿意支付以100元人民币每字计的稿费,敬请留意。


注1:本文基于Win x64位平台来讲解,x86基本相同:

注2:本文所用软件环境(最新测试通过版本):
Visual Studio2013
cmake3.0.2
boost1.56.0
MySQL Community Server5.6.21
MySQL Connector/C6.1.5
MySQL Connector/C++1.1.4


1 下载软件包

1.1 安装MySQL服务器(MySQL Community Server):http://dev.mysql.com/downloads/mysql/ 
注:注意选择所需平台;
1.2 编译MySQL Community Server :http://dev.mysql.com/downloads/mysql/ 
注:在该下载页面时,我们要在“Select Platform”下选择“Source Code”,否则会在编译时出现如下错误;
CMake Error: The source directory “*” does not appear to contain CMakeLists.txt.
Specify –help for usage, or press the help button on the CMake GUI.
1.3 MySQL Connector/C:http://dev.mysql.com/downloads/connector/c/ 
注:在该下载页面时,我们要在“Select Platform”下选择“Source Code”,否则会在编译时出现如上错误;
1.4 MySQL Connector/C++:http://dev.mysql.com/downloads/connector/cpp/ 
注:在该下载页面时,我们要在“Select Platform”下选择“Source Code”,否则会在编译时出现如上错误;
1.5 Boost:http://www.boost.org/users/download/ 
注:MySQL Connector/C++自1.1.0版本开始,就引入了Boost库;编译MySQL Connector/C可以忽略该软件包;
1.6 CMake:http://www.cmake.org/cmake/resources/software.html 
注:MySQL自5.6版本开始,就开始使用CMake编译工具了
1.7 建议下载“MySQL Community Server”、“MySQL Connector/C”、“MySQL Connector/C++”的“非安装压缩包”


2 编译环境

2.1 方式一:新建环境bat文件
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
set PATH=%PATH%;E:\Projects\compile\cmake-3.0.2-win32-x86\bin
set MYSQL_DIR=D:\aaa\mysql_connector\mysql-5.6.21-winx64
set BOOST_ROOT=E:\Projects\compile\boost_1_56_0
cmd /K
双击打开bat文件
注1:x86平台,则只需去除第一句中的“amd64”
注2:编译MySQL Community Server不需要设置MYSQL_DIR和BOOST_ROOT
注3:编译MySQL Connector/C不需要设置BOOST_ROOT
注4:为方便,可以始终设置MYSQL_DIR和BOOST_ROOT
2.2 方式二:点击“开始”-->"所有程序"-->"Visual Studio 2013"-->"Visual Studio Tools"-->"VS2013 x64 本机工具命令提示" 打开命令窗口在命令窗口中输入:
set PATH=%PATH%;E:\Projects\compile\cmake-3.0.2-win32-x86\bin
set MYSQL_DIR=D:\aaa\mysql_connector\mysql-5.6.21-winx64
set BOOST_ROOT=E:\Projects\compile\boost_1_56_0
注:同2.1注


3 编译“MySQL Community Server”

3.1 解压“mysql-5.6.21.zip”到当前文件夹,用以下命令切换到“mysql-5.6.21”目录: 
cd /d D:\aaa\mysql_connector\mysql-5.6.21
3.2 字符集问题:用“Notepad++”打开以下文件,特别是“mysql-5.6.21\sql\sql_locale.cc”文件,在菜单“格式”中选择“以UTF-8格式编码”或“以UCS-2 Litte Encode格式编码(推荐,与方式二等效)”,保存。注意,不要用“转为UTF-8编码格式”!;方式二(推荐):用“Visual Studio”打开这些文件,点击【文件】在【高级保存选项】对话框中,设置“编码”的值为“Unicode-代码页1200”。

mysql-5.6.21\mysys\thr_mutex.c *
mysql-5.6.21\strings\ctype-czech.c
mysql-5.6.21\strings\ctype-latin1.c
mysql-5.6.21\strings\decimal.c
mysql-5.6.21\storage\innobase\include\ut0mem.h
mysql-5.6.21\storage\innobase\include\ut0ut.h
mysql-5.6.21\storage\innobase\ut\ut0ut.cc
mysql-5.6.21\sql\sql_locale.cc
mysql-5.6.21\sql\sql_lex.cc
mysql-5.6.21\sql\opt_trace2server.cc
mysql-5.6.21\sql\rpl_info_file.cc
/scripts/sql_commands_help_data.h
boost_1_59_0\boost\format\alt_sstream_impl.hpp
warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失:
http://blog.csdn.net/enjoy517905407/article/details/37958035/
3.3 目前只有工程“initial_database”会失败,可以将“mysql-5.6.21\sql\mysqld.cc”函数static void test_lc_time_sz()中注释掉“DBUG_ASSERT(0);”一句;原因是(详见“参考文章第二篇”):日本语的时候,其字符串有三个汉字大小,按宽字符应该是长度为3,当mysql-5.6.21\sql\mysqld.cc中按utf8字符算长度,长度一下扩大一倍,变成6了,所以对不少,直接 assert退出。
3.4 解决非Debug版本编译后执行“cmake --build . --target INSTALL --config RelWithDebInfo”命令时,签名失败的问题,在“mysql-5.6.21\cmake\install_macros.cmake”文件中的语句
INSTALL(CODE
   "EXECUTE_PROCESS(COMMAND 
     ${SIGNTOOL_EXECUTABLE} sign ${SIGNTOOL_PARAMETERS} ${target_location}
     RESULT_VARIABLE ERR)
之前增加语句
STRING(CONCAT SIGNTOOL_EXECUTABLE "\"" ${SIGNTOOL_EXECUTABLE} "\"")
原因是(其中一个例子,结合步骤3.7见文件“mysql-5.6.21\bld_release_x64\storage\myisam\cmake_install.cmake”):
C:/Program Files (x86)/Windows Kits/8.1/bin/x64/signtool.exe sign /a;/t;http://timestamp.verisign.com/scripts/timstamp.dll D:/aaa/mysql_connector/mysql-5.6.21/bld_release_x64/storage/myisam//${CMAKE_INSTALL_CONFIG_NAME}//myisam_ftdump.exe
中“signtool”工具有空格,命令行不能将其正确识别.
3.5 MySQL Source-Configuration Options:
http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
3.6 Debug编译,请依次输入以下命令:
set PATH=%PATH%;E:\Projects\compile\cmake-3.0.2-win32-x86\bin

mkdir bld_debug_x64
cd bld_debug_x64

cmake .. -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=D:\comm\mysql\debug_x64 
cmake --build . --target INSTALL --config Debug
devenv mysql.sln /build Debug /out logfile.txt
如要重新编译,则先输入以下命令:
del CMakeCache.txt
devenv mysql.sln /clean Debug
3.7 RelWithDebInfo编译,请依次输入以下命令:
set PATH=%PATH%;E:\Projects\compile\cmake-3.0.2-win32-x86\bin

mkdir bld_release_x64
cd bld_release_x64

cmake .. -G "Visual Studio 12 Win64" -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=D:\comm\mysql\release_x64 

将当前目录下的“.\sql\create_initial_db.cmake”文件(本例为:mysql-5.6.21\bld_release_x64\sql\create_initial_db.cmake)中:
“SET(MYSQLD_EXECUTABLE”项中的“sql/DEBUG/mysqld-debug.exe”更改为“sql/$(Configuration)/mysqld.exe”

cmake --build . --target INSTALL --config RelWithDebInfo 
devenv mysql.sln /build RelWithDebInfo /out logfile.txt
如要重新编译,则先输入以下命令:
del CMakeCache.txt
devenv mysql.sln /clean RelWithDebInfo
3.8 “MinSizeRel”、“Release”版本的编译与“3.6”和“3.7”类似;
3.9 编译单个工程,可用如下相似命令:
build project libmysql
3.10 解压“mysql-5.6.21-winx64.zip”到当前文件夹
注:编译“MySQL Connector/C”、“MySQL Connector/C++”将用到
3.10.1 将“mysql-5.6.21-winx64\lib”中的内容用“3.6-3.8”编译后对应的文件替换,如实在找不到对应版本的“pdb”文件,可以不予理会,但“lib”,“dll”文件一定要替换;
3.10.2 将如果在“mysql-5.6.20-winx64\lib”文件下“lib”、“lib\plugin”没有的,而在“lib\debug”、“lib\plugin\debug”有的,要添加对应release版本到对应文件夹,反之亦然,因为编译“MySQL Connector/C++”将用到;
3.10.3 Debug拷贝命令:
mkdir D:\comm
mkdir D:\comm\mysql
mkdir D:\comm\mysql\x64
mkdir D:\comm\mysql\x64\include
xcopy /E /H /R D:\aaa\mysql_connector\mysql-5.6.21-winx64\include\* D:\comm\mysql\x64\include 

mkdir D:\comm\mysql\x64\lib
mkdir D:\comm\mysql\x64\lib\debug

copy /Y libmysql\authentication_win\Debug\auth_win_client.lib D:\comm\mysql\x64\lib\debug
copy /Y libmysql\authentication_win\Debug\auth_win_client.pdb D:\comm\mysql\x64\lib\debug
copy /Y libmysql\authentication_win\Debug\auth_win_client.dll D:\comm\mysql\x64\lib\debug
copy /Y libmysql\Debug\clientlib.lib D:\comm\mysql\x64\lib\debug
copy /Y libmysql\Debug\clientlib.pdb D:\comm\mysql\x64\lib\debug
copy /Y libmysql\Debug\clientlib.dll D:\comm\mysql\x64\lib\debug
copy /Y libmysql\Debug\mysqlclient.lib D:\comm\mysql\x64\lib\debug
copy /Y libmysql\Debug\mysqlclient.pdb D:\comm\mysql\x64\lib\debug
copy /Y libmysql\Debug\mysqlclient.dll D:\comm\mysql\x64\lib\debug
copy /Y libmysqld\Debug\mysqlserver.lib D:\comm\mysql\x64\lib\debug
copy /Y libmysqld\Debug\mysqlserver.pdb D:\comm\mysql\x64\lib\debug
copy /Y libmysqld\Debug\mysqlserver.dll D:\comm\mysql\x64\lib\debug
copy /Y mysys\Debug\mysys.lib D:\comm\mysql\x64\lib\debug
copy /Y mysys\Debug\mysys.pdb D:\comm\mysql\x64\lib\debug
copy /Y mysys\Debug\mysys.dll D:\comm\mysql\x64\lib\debug
copy /Y mysys_ssl\Debug\mysys_ssl.lib D:\comm\mysql\x64\lib\debug
copy /Y mysys_ssl\Debug\mysys_ssl.pdb D:\comm\mysql\x64\lib\debug
copy /Y mysys_ssl\Debug\mysys_ssl.dll D:\comm\mysql\x64\lib\debug
copy /Y strings\Debug\strings.lib D:\comm\mysql\x64\lib\debug
copy /Y strings\Debug\strings.pdb D:\comm\mysql\x64\lib\debug
copy /Y strings\Debug\strings.dll D:\comm\mysql\x64\lib\debug
copy /Y extra\yassl\taocrypt\Debug\taocrypt.lib D:\comm\mysql\x64\lib\debug
copy /Y extra\yassl\taocrypt\Debug\taocrypt.pdb D:\comm\mysql\x64\lib\debug
copy /Y extra\yassl\taocrypt\Debug\taocrypt.dll D:\comm\mysql\x64\lib\debug
copy /Y vio\Debug\vio.lib D:\comm\mysql\x64\lib\debug
copy /Y vio\Debug\vio.pdb D:\comm\mysql\x64\lib\debug
copy /Y vio\Debug\vio.dll D:\comm\mysql\x64\lib\debug
copy /Y extra\yassl\Debug\yassl.lib D:\comm\mysql\x64\lib\debug
copy /Y extra\yassl\Debug\yassl.pdb D:\comm\mysql\x64\lib\debug
copy /Y extra\yassl\Debug\yassl.dll D:\comm\mysql\x64\lib\debug
copy /Y zlib\Debug\zlib.lib D:\comm\mysql\x64\lib\debug
copy /Y zlib\Debug\zlib.pdb D:\comm\mysql\x64\lib\debug
copy /Y zlib\Debug\zlib.dll D:\comm\mysql\x64\lib\debug
copy /Y libmysql\Debug\libmysql.dll D:\comm\mysql\x64\lib\debug
copy /Y libmysql\Debug\libmysql.lib D:\comm\mysql\x64\lib\debug
copy /Y libmysql\Debug\libmysql.pdb D:\comm\mysql\x64\lib\debug
copy /Y libmysqld\Debug\libmysqld.dll D:\comm\mysql\x64\lib\debug
copy /Y libmysqld\Debug\libmysqld.lib D:\comm\mysql\x64\lib\debug
copy /Y libmysqld\Debug\libmysqld.pdb D:\comm\mysql\x64\lib\debug
copy /Y libservices\Debug\mysqlservices.lib D:\comm\mysql\x64\lib\debug
copy /Y libservices\Debug\mysqlservices.dll D:\comm\mysql\x64\lib\debug
copy /Y libservices\Debug\mysqlservices.pdb D:\comm\mysql\x64\lib\debug

mkdir D:\comm\mysql\x64\lib\plugin
mkdir D:\comm\mysql\x64\lib\plugin\debug

copy /Y plugin\audit_null\Debug\adt_null.dll D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\audit_null\Debug\adt_null.pdb D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\audit_null\Debug\adt_null.lib D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\auth.dll D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\auth.pdb D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\auth.lib D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\auth_test_plugin.dll D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\auth_test_plugin.pdb D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\auth_test_plugin.lib D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\daemon_example\daemon_example.ini D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\daemon_example\Debug\libdaemon_example.dll D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\daemon_example\Debug\libdaemon_example.pdb D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\daemon_example\Debug\libdaemon_example.lib D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\fulltext\Debug\mypluglib.dll D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\fulltext\Debug\mypluglib.pdb D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\fulltext\Debug\mypluglib.lib D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\qa_auth_client.dll D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\qa_auth_client.pdb D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\qa_auth_client.lib D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\qa_auth_interface.dll D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\qa_auth_interface.pdb D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\qa_auth_interface.lib D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\qa_auth_server.dll D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\qa_auth_server.pdb D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\auth\Debug\qa_auth_server.lib D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\semisync\Debug\semisync_master.dll D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\semisync\Debug\semisync_master.pdb D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\semisync\Debug\semisync_master.lib D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\semisync\Debug\semisync_slave.dll D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\semisync\Debug\semisync_slave.pdb D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\semisync\Debug\semisync_slave.lib D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\password_validation\Debug\validate_password.dll D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\password_validation\Debug\validate_password.pdb D:\comm\mysql\x64\lib\plugin\debug
copy /Y plugin\password_validation\Debug\validate_password.lib D:\comm\mysql\x64\lib\plugin\debug

3.10.4 RelWithDebInfo拷贝命令:
mkdir D:\comm
mkdir D:\comm\mysql
mkdir D:\comm\mysql\x64
mkdir D:\comm\mysql\x64\include
xcopy /E /H /R D:\aaa\mysql_connector\mysql-5.6.21-winx64\include\* D:\comm\mysql\x64\include 

mkdir D:\comm\mysql\x64\lib

copy /Y libmysql\authentication_win\RelWithDebInfo\auth_win_client.lib D:\comm\mysql\x64\lib
copy /Y libmysql\authentication_win\RelWithDebInfo\auth_win_client.pdb D:\comm\mysql\x64\lib
copy /Y libmysql\authentication_win\RelWithDebInfo\auth_win_client.dll D:\comm\mysql\x64\lib
copy /Y libmysql\RelWithDebInfo\clientlib.lib D:\comm\mysql\x64\lib
copy /Y libmysql\RelWithDebInfo\clientlib.pdb D:\comm\mysql\x64\lib
copy /Y libmysql\RelWithDebInfo\clientlib.dll D:\comm\mysql\x64\lib
copy /Y libmysql\RelWithDebInfo\mysqlclient.lib D:\comm\mysql\x64\lib
copy /Y libmysql\RelWithDebInfo\mysqlclient.pdb D:\comm\mysql\x64\lib
copy /Y libmysql\RelWithDebInfo\mysqlclient.dll D:\comm\mysql\x64\lib
copy /Y libmysqld\RelWithDebInfo\mysqlserver.lib D:\comm\mysql\x64\lib
copy /Y libmysqld\RelWithDebInfo\mysqlserver.pdb D:\comm\mysql\x64\lib
copy /Y libmysqld\RelWithDebInfo\mysqlserver.dll D:\comm\mysql\x64\lib
copy /Y mysys\RelWithDebInfo\mysys.lib D:\comm\mysql\x64\lib
copy /Y mysys\RelWithDebInfo\mysys.pdb D:\comm\mysql\x64\lib
copy /Y mysys\RelWithDebInfo\mysys.dll D:\comm\mysql\x64\lib
copy /Y mysys_ssl\RelWithDebInfo\mysys_ssl.lib D:\comm\mysql\x64\lib
copy /Y mysys_ssl\RelWithDebInfo\mysys_ssl.pdb D:\comm\mysql\x64\lib
copy /Y mysys_ssl\RelWithDebInfo\mysys_ssl.dll D:\comm\mysql\x64\lib
copy /Y strings\RelWithDebInfo\strings.lib D:\comm\mysql\x64\lib
copy /Y strings\RelWithDebInfo\strings.pdb D:\comm\mysql\x64\lib
copy /Y strings\RelWithDebInfo\strings.dll D:\comm\mysql\x64\lib
copy /Y extra\yassl\taocrypt\RelWithDebInfo\taocrypt.lib D:\comm\mysql\x64\lib
copy /Y extra\yassl\taocrypt\RelWithDebInfo\taocrypt.pdb D:\comm\mysql\x64\lib
copy /Y extra\yassl\taocrypt\RelWithDebInfo\taocrypt.dll D:\comm\mysql\x64\lib
copy /Y vio\RelWithDebInfo\vio.lib D:\comm\mysql\x64\lib
copy /Y vio\RelWithDebInfo\vio.pdb D:\comm\mysql\x64\lib
copy /Y vio\RelWithDebInfo\vio.dll D:\comm\mysql\x64\lib
copy /Y extra\yassl\RelWithDebInfo\yassl.lib D:\comm\mysql\x64\lib
copy /Y extra\yassl\RelWithDebInfo\yassl.pdb D:\comm\mysql\x64\lib
copy /Y extra\yassl\RelWithDebInfo\yassl.dll D:\comm\mysql\x64\lib
copy /Y zlib\RelWithDebInfo\zlib.lib D:\comm\mysql\x64\lib
copy /Y zlib\RelWithDebInfo\zlib.pdb D:\comm\mysql\x64\lib
copy /Y zlib\RelWithDebInfo\zlib.dll D:\comm\mysql\x64\lib
copy /Y libmysql\RelWithDebInfo\libmysql.dll D:\comm\mysql\x64\lib
copy /Y libmysql\RelWithDebInfo\libmysql.lib D:\comm\mysql\x64\lib
copy /Y libmysql\RelWithDebInfo\libmysql.pdb D:\comm\mysql\x64\lib
copy /Y libmysqld\RelWithDebInfo\libmysqld.dll D:\comm\mysql\x64\lib
copy /Y libmysqld\RelWithDebInfo\libmysqld.lib D:\comm\mysql\x64\lib
copy /Y libmysqld\RelWithDebInfo\libmysqld.pdb D:\comm\mysql\x64\lib
copy /Y libservices\RelWithDebInfo\mysqlservices.lib D:\comm\mysql\x64\lib
copy /Y libservices\RelWithDebInfo\mysqlservices.dll D:\comm\mysql\x64\lib
copy /Y libservices\RelWithDebInfo\mysqlservices.pdb D:\comm\mysql\x64\lib

mkdir D:\comm\mysql\x64\lib\plugin

copy /Y plugin\audit_null\RelWithDebInfo\adt_null.dll D:\comm\mysql\x64\lib\plugin
copy /Y plugin\audit_null\RelWithDebInfo\adt_null.pdb D:\comm\mysql\x64\lib\plugin
copy /Y plugin\audit_null\RelWithDebInfo\adt_null.lib D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\auth.dll D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\auth.pdb D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\auth.lib D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\auth_test_plugin.dll D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\auth_test_plugin.pdb D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\auth_test_plugin.lib D:\comm\mysql\x64\lib\plugin
copy /Y plugin\daemon_example\daemon_example.ini D:\comm\mysql\x64\lib\plugin
copy /Y plugin\daemon_example\RelWithDebInfo\libdaemon_example.dll D:\comm\mysql\x64\lib\plugin
copy /Y plugin\daemon_example\RelWithDebInfo\libdaemon_example.pdb D:\comm\mysql\x64\lib\plugin
copy /Y plugin\daemon_example\RelWithDebInfo\libdaemon_example.lib D:\comm\mysql\x64\lib\plugin
copy /Y plugin\fulltext\RelWithDebInfo\mypluglib.dll D:\comm\mysql\x64\lib\plugin
copy /Y plugin\fulltext\RelWithDebInfo\mypluglib.pdb D:\comm\mysql\x64\lib\plugin
copy /Y plugin\fulltext\RelWithDebInfo\mypluglib.lib D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\qa_auth_client.dll D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\qa_auth_client.pdb D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\qa_auth_client.lib D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\qa_auth_interface.dll D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\qa_auth_interface.pdb D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\qa_auth_interface.lib D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\qa_auth_server.dll D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\qa_auth_server.pdb D:\comm\mysql\x64\lib\plugin
copy /Y plugin\auth\RelWithDebInfo\qa_auth_server.lib D:\comm\mysql\x64\lib\plugin
copy /Y plugin\semisync\RelWithDebInfo\semisync_master.dll D:\comm\mysql\x64\lib\plugin
copy /Y plugin\semisync\RelWithDebInfo\semisync_master.pdb D:\comm\mysql\x64\lib\plugin
copy /Y plugin\semisync\RelWithDebInfo\semisync_master.lib D:\comm\mysql\x64\lib\plugin
copy /Y plugin\semisync\RelWithDebInfo\semisync_slave.dll D:\comm\mysql\x64\lib\plugin
copy /Y plugin\semisync\RelWithDebInfo\semisync_slave.pdb D:\comm\mysql\x64\lib\plugin
copy /Y plugin\semisync\RelWithDebInfo\semisync_slave.lib D:\comm\mysql\x64\lib\plugin
copy /Y plugin\password_validation\RelWithDebInfo\validate_password.dll D:\comm\mysql\x64\lib\plugin
copy /Y plugin\password_validation\RelWithDebInfo\validate_password.pdb D:\comm\mysql\x64\lib\plugin
copy /Y plugin\password_validation\RelWithDebInfo\validate_password.lib D:\comm\mysql\x64\lib\plugin


4 编译“MySQL Connector/C”

4.1 解压“mysql-connector-c-6.1.5-src.zip”到当前文件夹,用以下命令切换到“mysql-connector-c-6.1.5-src”目录:
cd /d D:\aaa\mysql_connector\mysql-connector-c-6.1.5-src
4.2 解决非Debug版本编译后执行“cmake --build . --target INSTALL --config RelWithDebInfo”命令时,签名失败的问题:“mysql-connector-c-6.1.5-src\cmake\install_macros.cmake”文件中的语句
   INSTALL(CODE
   "EXECUTE_PROCESS(COMMAND 
     ${SIGNTOOL_EXECUTABLE} sign ${SIGNTOOL_PARAMETERS} ${target_location}
     RESULT_VARIABLE ERR)
之前增加语句
STRING(CONCAT SIGNTOOL_EXECUTABLE "\"" ${SIGNTOOL_EXECUTABLE} "\"")
原因同3.4;
4.3 解决编译后执行“cmake --build . --target INSTALL”命令时,找不到对应“.pdb”文件的问题:“mysql-connector-c-6.1.5-src\cmake\install_macros.cmake”文件中的语句:
INSTALL(FILES ${pdb_location} DESTINATION ${INSTALL_LOCATION} COMPONENT ${comp})
替换为
# No .pdb file for static libraries.
IF(NOT type MATCHES "STATIC_LIBRARY")	
  INSTALL(FILES ${pdb_location} DESTINATION ${INSTALL_LOCATION} COMPONENT ${comp})
ENDIF()
4.4 Debug编译,请依次输入以下命令:
set PATH=%PATH%;E:\Projects\compile\cmake-3.0.2-win32-x86\bin
set MYSQL_DIR=D:\comm\mysql\x64

mkdir bld_debug_x64
cd bld_debug_x64

cmake .. -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=D:\comm\libmysql\debug_x64
cmake --build . --target INSTALL --config Debug 
devenv libmysql.sln /build Debug /out logfile.txt

注:cmake一句有如下选项可供选择:
-DWITH_SSL=system  Enable dynamic linking to the system OpenSSL library.
-DWITH_ZLIB=system Enable dynamic linking to the system Zlib library.
如要重新编译,则先输入以下命令:
del CMakeCache.txt
devenv libmysql.sln /clean Debug
4.5 RelWithDebInfo编译,请依次输入以下命令:
set PATH=%PATH%;E:\Projects\compile\cmake-3.0.2-win32-x86\bin
set MYSQL_DIR=D:\comm\mysql\x64

mkdir bld_release_x64
cd bld_release_x64

cmake .. -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=D:\comm\libmysql\release_x64 
cmake --build . --target INSTALL --config RelWithDebInfo
devenv libmysql.sln /build RelWithDebInfo /out logfile.txt

注:cmake一句有如下选项可供选择:
-DWITH_SSL=system  Enable dynamic linking to the system OpenSSL library.
-DWITH_ZLIB=system Enable dynamic linking to the system Zlib library.
如要重新编译,则先输入以下命令:
del CMakeCache.txt
devenv libmysql.sln /clean RelWithDebInfo
4.6 “MinSizeRel”、“Release”版本的编译与“4.4”和“4.5”类似;
4.7 编译单个工程,可用如下相似命令:
build project libmysql
4.8 解压“mysql-connector-c-6.1.5-winx64.zip”到当前文件夹
4.8.1 将“mysql-connector-c-6.1.5-winx64\lib”中的内容用“4.2-4.4”编译后对应的文件替换,如实在找不到对应版本的“pdb”文件,可以不予理会,但“lib”,“dll”文件一定要替换;
4.8.2 将如果在“mysql-connector-c-6.1.5-winx64\lib”文件下“lib”没有的,而在“lib\debug”有的,要添加对应release版本到对应文件夹,反之亦然,因为编译在用VS编程的过程有可能将用到;
4.8.3 Debug拷贝命令:
mkdir D:\comm
mkdir D:\comm\libmysql
mkdir D:\comm\libmysql\x64
mkdir D:\comm\libmysql\x64\include
xcopy /E /H /R D:\aaa\mysql_connector\mysql-connector-c-6.1.5-winx64\include\* D:\comm\libmysql\x64\include 

mkdir D:\comm\libmysql\x64\lib
mkdir D:\comm\libmysql\x64\lib\debug

copy /Y libmysql\authentication_win\Debug\auth_win_client.lib D:\comm\libmysql\x64\lib\debug
copy /Y libmysql\authentication_win\Debug\auth_win_client.pdb D:\comm\libmysql\x64\lib\debug
copy /Y libmysql\authentication_win\Debug\auth_win_client.dll D:\comm\libmysql\x64\lib\debug
copy /Y libmysql\Debug\clientlib.lib D:\comm\libmysql\x64\lib\debug
copy /Y libmysql\Debug\clientlib.pdb D:\comm\libmysql\x64\lib\debug
copy /Y libmysql\Debug\clientlib.dll D:\comm\libmysql\x64\lib\debug
copy /Y libmysql\Debug\mysqlclient.lib D:\comm\libmysql\x64\lib\debug
copy /Y libmysql\Debug\mysqlclient.pdb D:\comm\libmysql\x64\lib\debug
copy /Y libmysql\Debug\mysqlclient.dll D:\comm\libmysql\x64\lib\debug
copy /Y mysys\Debug\mysys.lib D:\comm\libmysql\x64\lib\debug
copy /Y mysys\Debug\mysys.pdb D:\comm\libmysql\x64\lib\debug
copy /Y mysys\Debug\mysys.dll D:\comm\libmysql\x64\lib\debug
copy /Y mysys_ssl\Debug\mysys_ssl.lib D:\comm\libmysql\x64\lib\debug
copy /Y mysys_ssl\Debug\mysys_ssl.pdb D:\comm\libmysql\x64\lib\debug
copy /Y mysys_ssl\Debug\mysys_ssl.dll D:\comm\libmysql\x64\lib\debug
copy /Y strings\Debug\strings.lib D:\comm\libmysql\x64\lib\debug
copy /Y strings\Debug\strings.pdb D:\comm\libmysql\x64\lib\debug
copy /Y strings\Debug\strings.dll D:\comm\libmysql\x64\lib\debug
copy /Y extra\yassl\taocrypt\Debug\taocrypt.lib D:\comm\libmysql\x64\lib\debug
copy /Y extra\yassl\taocrypt\Debug\taocrypt.pdb D:\comm\libmysql\x64\lib\debug
copy /Y extra\yassl\taocrypt\Debug\taocrypt.dll D:\comm\libmysql\x64\lib\debug
copy /Y vio\Debug\vio.lib D:\comm\libmysql\x64\lib\debug
copy /Y vio\Debug\vio.pdb D:\comm\libmysql\x64\lib\debug
copy /Y vio\Debug\vio.dll D:\comm\libmysql\x64\lib\debug
copy /Y extra\yassl\Debug\yassl.lib D:\comm\libmysql\x64\lib\debug
copy /Y extra\yassl\Debug\yassl.pdb D:\comm\libmysql\x64\lib\debug
copy /Y extra\yassl\Debug\yassl.dll D:\comm\libmysql\x64\lib\debug
copy /Y zlib\Debug\zlib.lib D:\comm\libmysql\x64\lib\debug
copy /Y zlib\Debug\zlib.pdb D:\comm\libmysql\x64\lib\debug
copy /Y zlib\Debug\zlib.dll D:\comm\libmysql\x64\lib\debug
copy /Y libmysql\Debug\libmysql.dll D:\comm\libmysql\x64\lib\debug
copy /Y libmysql\Debug\libmysql.lib D:\comm\libmysql\x64\lib\debug
copy /Y libmysql\Debug\libmysql.pdb D:\comm\libmysql\x64\lib\debug
4.8.4 RelWithDebInfo拷贝命令:
mkdir D:\comm
mkdir D:\comm\libmysql
mkdir D:\comm\libmysql\x64
mkdir D:\comm\libmysql\x64\include
xcopy /E /H /R D:\aaa\mysql_connector\mysql-connector-c-6.1.5-winx64\include\* D:\comm\libmysql\x64\include 

mkdir D:\comm\libmysql\x64\lib

copy /Y libmysql\authentication_win\RelWithDebInfo\auth_win_client.lib D:\comm\libmysql\x64\lib
copy /Y libmysql\authentication_win\RelWithDebInfo\auth_win_client.pdb D:\comm\libmysql\x64\lib
copy /Y libmysql\authentication_win\RelWithDebInfo\auth_win_client.dll D:\comm\libmysql\x64\lib
copy /Y libmysql\RelWithDebInfo\clientlib.lib D:\comm\libmysql\x64\lib
copy /Y libmysql\RelWithDebInfo\clientlib.pdb D:\comm\libmysql\x64\lib
copy /Y libmysql\RelWithDebInfo\clientlib.dll D:\comm\libmysql\x64\lib
copy /Y libmysql\RelWithDebInfo\mysqlclient.lib D:\comm\libmysql\x64\lib
copy /Y libmysql\RelWithDebInfo\mysqlclient.pdb D:\comm\libmysql\x64\lib
copy /Y libmysql\RelWithDebInfo\mysqlclient.dll D:\comm\libmysql\x64\lib
copy /Y mysys\RelWithDebInfo\mysys.lib D:\comm\libmysql\x64\lib
copy /Y mysys\RelWithDebInfo\mysys.pdb D:\comm\libmysql\x64\lib
copy /Y mysys\RelWithDebInfo\mysys.dll D:\comm\libmysql\x64\lib
copy /Y mysys_ssl\RelWithDebInfo\mysys_ssl.lib D:\comm\libmysql\x64\lib
copy /Y mysys_ssl\RelWithDebInfo\mysys_ssl.pdb D:\comm\libmysql\x64\lib
copy /Y mysys_ssl\RelWithDebInfo\mysys_ssl.dll D:\comm\libmysql\x64\lib
copy /Y strings\RelWithDebInfo\strings.lib D:\comm\libmysql\x64\lib
copy /Y strings\RelWithDebInfo\strings.pdb D:\comm\libmysql\x64\lib
copy /Y strings\RelWithDebInfo\strings.dll D:\comm\libmysql\x64\lib
copy /Y extra\yassl\taocrypt\RelWithDebInfo\taocrypt.lib D:\comm\libmysql\x64\lib
copy /Y extra\yassl\taocrypt\RelWithDebInfo\taocrypt.pdb D:\comm\libmysql\x64\lib
copy /Y extra\yassl\taocrypt\RelWithDebInfo\taocrypt.dll D:\comm\libmysql\x64\lib
copy /Y vio\RelWithDebInfo\vio.lib D:\comm\libmysql\x64\lib
copy /Y vio\RelWithDebInfo\vio.pdb D:\comm\libmysql\x64\lib
copy /Y vio\RelWithDebInfo\vio.dll D:\comm\libmysql\x64\lib
copy /Y extra\yassl\RelWithDebInfo\yassl.lib D:\comm\libmysql\x64\lib
copy /Y extra\yassl\RelWithDebInfo\yassl.pdb D:\comm\libmysql\x64\lib
copy /Y extra\yassl\RelWithDebInfo\yassl.dll D:\comm\libmysql\x64\lib
copy /Y zlib\RelWithDebInfo\zlib.lib D:\comm\libmysql\x64\lib
copy /Y zlib\RelWithDebInfo\zlib.pdb D:\comm\libmysql\x64\lib
copy /Y zlib\RelWithDebInfo\zlib.dll D:\comm\libmysql\x64\lib
copy /Y libmysql\RelWithDebInfo\libmysql.dll D:\comm\libmysql\x64\lib
copy /Y libmysql\RelWithDebInfo\libmysql.lib D:\comm\libmysql\x64\lib
copy /Y libmysql\RelWithDebInfo\libmysql.pdb D:\comm\libmysql\x64\lib
4.8.5 如果在“mysql-connector-c-6.1.5-winx64”文件下“lib”没有对应“vs”版本的,如本例中的“vs12”,新建对应文件夹,按其它vs版本的目录结构备份相关文件;


5 编译“MySQL Connector/C++”

5.1 解压“mysql-connector-c++-1.1.4.zip”到当前文件夹,用以下命令切换到“mysql-connector-c++-1.1.4”目录:
cd /d D:\aaa\mysql_connector\mysql-connector-c++-1.1.4
5.2 注释掉“mysql-connector-c++-1.1.4\test\common\ccppTypes.h”中“line70-72”宏“strtoll”和“strtoull”
//#else
//#  define strtoll(x, e, b) _strtoi64((x), (e), (b))
//#  define strtoull(x, e, b) _strtoui64((x), (e), (b))
5.3 解决编译后执行“cmake --build . --target INSTALL”命令时,找不到对应“config.h”文件的问题:“mysql-connector-c++-1.1.4\cppconn\CMakeLists.txt”文件中的语句:
SET(MYSQLCPPCONN_INSTALL_HEADERS
		build_config.h
		config.h
		connection.h
		datatype.h
		driver.h
		exception.h
		metadata.h
		parameter_metadata.h
		prepared_statement.h
		resultset.h
		resultset_metadata.h
		statement.h
		sqlstring.h
		warning.h)
中的
config.h
替换为
${CMAKE_CURRENT_BINARY_DIR}/config.h
5.4 采用“MYSQLCLIENT_STATIC_BINDING:BOOL=1”编译时请参考该步骤,否则绕过;
5.4.1 成功编译“mysqlcppconn”工程的方法:将“mysql-connector-c++-1.1.4\driver\CMakeLists.txt”文件中的语句:
SET_TARGET_PROPERTIES(mysqlcppconn PROPERTIES
    LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMTD /NODEFAULTLIB:LIBCMT"
    LINK_FLAGS_RELWITHDEBINFO "/NODEFAULTLIB:LIBCMT"
    LINK_FLAGS_RELEASE "/NODEFAULTLIB:LIBCMT")

    SET_TARGET_PROPERTIES(mysqlcppconn-static PROPERTIES
    STATIC_LIBRARY_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMTD"
    STATIC_LIBRARY_FLAGS_RELWITHDEBINFO "/NODEFAULTLIB:LIBCMT"
    STATIC_LIBRARY_FLAGS_RELEASE "/NODEFAULTLIB:LIBCMT")

	# Changing CRT from dynamic to static
	#INCLUDE(${CMAKE_SOURCE_DIR}/changeCrt.cmake)
	#CHANGE_CRT("/MT")
替换为
	#SET_TARGET_PROPERTIES(mysqlcppconn PROPERTIES
    #LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMTD /NODEFAULTLIB:LIBCMT"
    #LINK_FLAGS_RELWITHDEBINFO "/NODEFAULTLIB:LIBCMT"
    #LINK_FLAGS_RELEASE "/NODEFAULTLIB:LIBCMT")

    #SET_TARGET_PROPERTIES(mysqlcppconn-static PROPERTIES
    #STATIC_LIBRARY_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMTD"
    #STATIC_LIBRARY_FLAGS_RELWITHDEBINFO "/NODEFAULTLIB:LIBCMT"
    #STATIC_LIBRARY_FLAGS_RELEASE "/NODEFAULTLIB:LIBCMT")

	# Changing CRT from dynamic to static
  INCLUDE(${CMAKE_SOURCE_DIR}/changeCrt.cmake)
  CHANGE_CRT("/MT")
否则会出现“mysqlclient.lib: error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MTd_StaticDebug”不匹配值“MDd_DynamicDebug””的问题
5.4.2 成功编译“test_art_resultset”工程修改量较大,具体方法如下:将“mysql-connector-c++-1.1.4\test\unit\classes\CMakeLists.txt”文件中的语句:
SET_TARGET_PROPERTIES(test_art_resultset PROPERTIES
    LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMTD /NODEFAULTLIB:LIBCMT"
    LINK_FLAGS_RELWITHDEBINFO "/NODEFAULTLIB:LIBCMT"
    LINK_FLAGS_RELEASE "/NODEFAULTLIB:LIBCMT")
替换为
    #SET_TARGET_PROPERTIES(test_art_resultset PROPERTIES
    #LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMTD /NODEFAULTLIB:LIBCMT"
    #LINK_FLAGS_RELWITHDEBINFO "/NODEFAULTLIB:LIBCMT"
    #LINK_FLAGS_RELEASE "/NODEFAULTLIB:LIBCMT")
且,在由该文件生成每个工程以及和测试相关工程中将“MDd”改为“MTd”或“MD”改为“MT”,具体做法:在以下文件
#CJUnitTestsPort
mysql-connector-c++-1.1.4\test\CJUnitTestsPort\CMakeLists.txt
#test_framework
mysql-connector-c++-1.1.4\test\framework\CMakeLists.txt
#unsorted_bugs
mysql-connector-c++-1.1.4\test\unit\bugs\CMakeLists.txt
#多个工程
mysql-connector-c++-1.1.4\test\unit\classes\CMakeLists.txt
#example
mysql-connector-c++-1.1.4\test\unit\example\CMakeLists.txt
#perf_statement
mysql-connector-c++-1.1.4\test\unit\performance\CMakeLists.txt
#bug123 bug456
mysql-connector-c++-1.1.4\test\unit\template_bug_group\CMakeLists.txt
中的每个
MESSAGE(STATUS
语句之前插入语句:
IF(WIN32)
  # Changing CRT from dynamic to static
  INCLUDE(${CMAKE_SOURCE_DIR}/changeCrt.cmake)
  CHANGE_CRT("/MT")
ENDIF(WIN32)
在“mysql-connector-c++-1.1.4\test\unit\template_bug_group\CMakeLists.txt”文件语句
TARGET_LINK_LIBRARIES(bug123 ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES})
之后也插入语句:
IF(WIN32)
  # Changing CRT from dynamic to static
  INCLUDE(${CMAKE_SOURCE_DIR}/changeCrt.cmake)
  CHANGE_CRT("/MT")
ENDIF(WIN32)
否则会出现“mysqlcppconn-static.lib: error LNK2038: 检测到“RuntimeLibrary”的不匹配项:  值“MTd_StaticDebug”不匹配值“MDd_DynamicDebug””的问题
5.5 Debug编译,请依次输入以下命令:
set PATH=%PATH%;E:\Projects\compile\cmake-3.0.2-win32-x86\bin
set MYSQL_DIR=D:\comm\libmysql\x64  
set BOOST_ROOT=D:\comm\boost_1_56_0  

mkdir bld_debug_x64
cd bld_debug_x64

#采用以下命令生成工程,不用进行步骤5.4
cmake .. -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=Debug -DMYSQLCLIENT_STATIC_BINDING:BOOL=0 -DCMAKE_INSTALL_PREFIX=D:\comm\mysqlcppconn\debug_x64

#采用以下命令生成工程,必须进行步骤5.4
cmake .. -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=D:\comm\mysqlcppconn\debug_x64

cmake --build . --target INSTALL --config Debug
devenv mysqlcppconn.sln /build Debug /out logfile.txt

注1:cmake一句有如下选项可供选择:
cmake -DMYSQLCLIENT_STATIC_BINDING:BOOL=1
cmake -DMYSQLCPPCONN_TRACE_ENABLE:BOOL=1
注2:cmake临时引入boost库 
-DBOOST_ROOT:STRING=D:\comm\boost_1_56_0
如要重新编译,则先输入以下命令:
del CMakeCache.txt
devenv mysqlcppconn.sln /clean Debug
5.6 RelWithDebInfo编译,请依次输入以下命令:
set PATH=%PATH%;E:\Projects\compile\cmake-3.0.2-win32-x86\bin
set MYSQL_DIR=D:\comm\libmysql\x64  
set BOOST_ROOT=D:\comm\boost_1_56_0  

mkdir bld_release_x64
cd bld_release_x64

#采用以下命令生成工程,不用进行步骤5.4
cmake .. -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DMYSQLCLIENT_STATIC_BINDING:BOOL=0 -DCMAKE_INSTALL_PREFIX=D:\comm\mysqlcppconn\release_x64 

#采用以下命令生成工程,必须进行步骤5.4
cmake .. -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=D:\comm\mysqlcppconn\release_x64

cmake --build . --target INSTALL --config RelWithDebInfo
devenv mysqlcppconn.sln /build RelWithDebInfo /out logfile.txt

注1:cmake一句有如下选项可供选择:
cmake -DMYSQLCLIENT_STATIC_BINDING:BOOL=1
cmake -DMYSQLCPPCONN_TRACE_ENABLE:BOOL=1
注2:cmake临时引入boost库 
-DBOOST_ROOT:STRING=D:\comm\boost_1_56_0
如要重新编译,则先输入以下命令:
del CMakeCache.txt
devenv mysqlcppconn.sln /clean RelWithDebInfo
5.7 “MinSizeRel”、“Release”版本的编译与“5.3”和“5.4”类似;
5.8 编译单个工程,可用如下相似命令:
build project mysqlcppconn
5.9 解压“mysql-connector-c++-noinstall-1.1.4-winx64.zip”到当前文件夹
5.9.1 将“mysql-connector-c++-noinstall-1.1.4-winx64\lib”中的内容用“5.3-5.4”编译后对应的文件替换,“lib”,“dll”文件一定要替换;
5.9.2 Debug拷贝命令:
mkdir D:\comm
mkdir D:\comm\mysqlcppconn
mkdir D:\comm\mysqlcppconn\x64
mkdir D:\comm\mysqlcppconn\x64\include
xcopy /E /H /R D:\aaa\mysql_connector\mysql-connector-c++-noinstall-1.1.4-winx64\include\* D:\comm\mysqlcppconn\x64\include 

mkdir D:\comm\mysqlcppconn\x64\lib
mkdir D:\comm\mysqlcppconn\x64\lib\debug

copy /Y driver\Debug\mysqlcppconn.lib D:\comm\mysqlcppconn\x64\lib\debug
copy /Y driver\Debug\mysqlcppconn.pdb D:\comm\mysqlcppconn\x64\lib\debug
copy /Y driver\Debug\mysqlcppconn.dll D:\comm\mysqlcppconn\x64\lib\debug
copy /Y driver\Debug\mysqlcppconn-static.lib D:\comm\mysqlcppconn\x64\lib\debug
copy /Y driver\Debug\mysqlcppconn-static.pdb D:\comm\mysqlcppconn\x64\lib\debug
copy /Y driver\Debug\mysqlcppconn-static.dll D:\comm\mysqlcppconn\x64\lib\debug
5.9.3 RelWithDebInfo拷贝命令:
mkdir D:\comm
mkdir D:\comm\mysqlcppconn
mkdir D:\comm\mysqlcppconn\x64
mkdir D:\comm\mysqlcppconn\x64\include
xcopy /E /H /R D:\aaa\mysql_connector\mysql-connector-c++-noinstall-1.1.4-winx64\include\* D:\comm\mysqlcppconn\x64\include 

mkdir D:\comm\mysqlcppconn\x64\lib\

copy /Y driver\RelWithDebInfo\mysqlcppconn.lib D:\comm\mysqlcppconn\x64\lib
copy /Y driver\RelWithDebInfo\mysqlcppconn.pdb D:\comm\mysqlcppconn\x64\lib
copy /Y driver\RelWithDebInfo\mysqlcppconn.dll D:\comm\mysqlcppconn\x64\lib
copy /Y driver\RelWithDebInfo\mysqlcppconn-static.lib D:\comm\mysqlcppconn\x64\lib
copy /Y driver\RelWithDebInfo\mysqlcppconn-static.pdb D:\comm\mysqlcppconn\x64\lib
copy /Y driver\RelWithDebInfo\mysqlcppconn-static.dll D:\comm\mysqlcppconn\x64\lib


6 参考文章

Windows下使用VS2010调试MySQL: http://www.omgdba.com/debugging-mysql-on-windows-using-vs2010/
MySQL vs2010编译调试和命令扩展: http://www.51testing.com/html/91/66291-805844.html
mysql5.1在windows下的编译方法: http://blog.csdn.net/hb_zxl/article/details/4298636
 类似资料: