{"id":46,"date":"2017-04-19T17:43:19","date_gmt":"2017-04-19T09:43:19","guid":{"rendered":"http:\/\/www.myway5.com\/?p=46"},"modified":"2017-04-19T18:13:11","modified_gmt":"2017-04-19T10:13:11","slug":"linux-complier-mysql-connector-cpp","status":"publish","type":"post","link":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/","title":{"rendered":"linux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp"},"content":{"rendered":"<p>\u9996\u5148\u5728github\u4e0a\u4e0b\u8f7dmysql-connector-cpp<\/p>\n<p>git clone https:\/\/github.com\/mysql\/mysql-connector-cpp.git<\/p>\n<p>git\u4e0a\u9762\u6709\u4e24\u4e2a\u5206\u652f\uff0c2.0\u7248\u672c\u662f\u652f\u6301mysql\u4f5c\u4e3a\u6587\u6863\u5b58\u50a8\u7684\u63a5\u53e3\uff0c1.1\u7248\u672c\u662f\u652f\u6301\u6b63\u5e38\u7684\u5173\u7cfb\u6570\u636e\u5e93\u5b58\u50a8\u63a5\u53e3<\/p>\n<p>\u9996\u5148\u6211\u4eec\u7f16\u8bd1\u5b89\u88c52.0\u7248\u672c\uff0c\u8fdb\u5165\u4ee3\u7801\u76ee\u5f55\u6267\u884c<\/p>\n<p>cmake .<\/p>\n<p>cmake &#8211;build . &#8211;config CCC<\/p>\n<p>cmake &#8211;build . &#8211;target install &#8211;config CCC<\/p>\n<p>\u5230\u8fd9\u91cc\u5df2\u7ecf\u5b89\u88c5\u5b8c\u6bd5.<\/p>\n<p>\u7136\u540e\u5230testapp\u4e0b\u7f16\u8bd1\u6d4b\u8bd5\u6837\u4f8b<\/p>\n<p>cmake .<\/p>\n<p>\u63d0\u793a\u51fa\u9519\uff0cWITH-CONCPP\u6ca1\u6709\u8bbe\u7f6e\uff0c\u6211\u8bd5\u4e86\u7f16\u8f91\/etc\/profile\u6587\u4ef6\uff0c\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a\/usr\/local\/mysql\/connector-c++-2.0\/,\u4f46\u662f\u4ecd\u7136\u63d0\u793a\u6ca1\u6709\u8bbe\u7f6e\uff0c\u4e8e\u662f\u6211\u5c06CMakeLists\u4e2d\u7684<\/p>\n<p>set(WITH_CONCPP $ENV{WITH_CONCPP} CACHE PATH &#8220;MySQL Connector\/C++ 2.0 install location&#8221;)<\/p>\n<p>\u6539\u4e3a<\/p>\n<p>set(WITH_CONCPP &#8220;\/usr\/local\/mysql\/connector-c++-2.0\/&#8221; CACHE PATH &#8220;MySQL Connector\/C++ 2.0 install location&#8221;)<\/p>\n<p>\u7ee7\u7eedcmake .<\/p>\n<p>\u63d0\u793a\u51fa\u9519\uff0c\u5728\/usr\/local\/mysql\/connector-c++-2.0\/lib64\u4e0b\u627e\u4e0d\u5230\u4f9d\u8d56\u5e93<\/p>\n<p>\u90a3\u4e48\u5c06\u76ee\u5f55\u4e0b\u751f\u6210\u7684 libmysqlcppconn2.so  libmysqlcppconn2.so.1  libmysqlcppconn2.so.1.0 \u62f7\u8d1d\u5230\/usr\/local\/mysql\/connector-c++-2.0\/lib64\u4e2d\uff0c\u6ca1\u6709\u7684\u521b\u5efa\u4e00\u4e2a\u5373\u53ef\u3002<\/p>\n<p>cmake .<\/p>\n<p>make<\/p>\n<p>\u5728run\u6587\u4ef6\u5939\u4e0b\u9762\u751f\u6210\u4e86\u4e24\u4e2a\u53ef\u6267\u884c\u6587\u4ef6<\/p>\n<p>devapi_test xapi_test<\/p>\n<p>\u8fd9\u4e24\u4e2a\u6587\u4ef6\u7684\u533a\u522b\u5728\u4e8e\uff0cxapi_test\u5b9e\u73b0\u4e86c\u7684\u63a5\u53e3\uff0c\u662f\u901a\u8fc7mysql\u7684\u4e00\u4e2a\u53eb\u505ax plugin\u7684\u63d2\u4ef6\u8fde\u63a5mysql\u7684\uff0c\u800cdevapi\u5219\u662f\u4f7f\u7528\u4e86c++\u7684\u63a5\u53e3\u3002\u6240\u4ee5\u5982\u679c\u4f7f\u7528xapi\u63a5\u53e3\u7684\u8bdd\uff0cmysql\u5b89\u88c5\u65f6\u5fc5\u987b\u5b89\u88c5x plugin<\/p>\n<p>\u63a5\u4e0b\u6765\u7f16\u8bd1\u5b89\u88c51.1\u7248\u672c\uff0c\u5148\u5c06\u5f53\u524d\u7684\u6539\u52a8\u90fdcommit\u4e86\uff0c\u7136\u540e<\/p>\n<p>git checkout 1.1\uff0c<\/p>\n<p>cmake .<\/p>\n<p>\u5982\u679c\u51fa\u9519\u3002<\/p>\n<p>\u62a5\u7f3a\u5c11boost\u5e93\u9519\u8bef\uff0c\u53ef\u4ee5<\/p>\n<p>sudo apt-get install libboost-all-dev<\/p>\n<p>\u62a5\u7f3a\u5c11mysql.h\u7b49\u9519\u8bef\uff0c\u53ef\u4ee5\u901a\u8fc7sudo apt-get install libmysql++-dev<\/p>\n<p>\u7136\u540emake<\/p>\n<p>sudo make install<\/p>\n<p>\u7136\u540e\u5c06\u751f\u6210\u7684\u52a8\u6001\u5e93\u62f7\u8d1d\u7684\/usr\/local\/lib\u4e0b<\/p>\n<p>sudo cp libmysqlcppconn.so* \/usr\/local\/lib\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\u5728github\u4e0a\u4e0b\u8f7dmysql-connector-cpp git clone https:\/\/githu &hellip; <a href=\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">linux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-46","post","type-post","status-publish","format-standard","hentry","category-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>linux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp - \u4e00\u53ea\u5b89\u9759\u7684\u732b<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"linux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp - \u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"og:description\" content=\"\u9996\u5148\u5728github\u4e0a\u4e0b\u8f7dmysql-connector-cpp git clone https:\/\/githu &hellip; \u7ee7\u7eed\u9605\u8bfblinux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-19T09:43:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-19T10:13:11+00:00\" \/>\n<meta name=\"author\" content=\"jiangpengfei\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"jiangpengfei\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/\"},\"author\":{\"name\":\"jiangpengfei\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"headline\":\"linux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp\",\"datePublished\":\"2017-04-19T09:43:19+00:00\",\"dateModified\":\"2017-04-19T10:13:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/\"},\"wordCount\":133,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"articleSection\":[\"linux\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/\",\"url\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/\",\"name\":\"linux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp - \u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/#website\"},\"datePublished\":\"2017-04-19T09:43:19+00:00\",\"dateModified\":\"2017-04-19T10:13:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.myway5.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"linux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.myway5.com\/#website\",\"url\":\"https:\/\/www.myway5.com\/\",\"name\":\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"description\":\"\u60f3\u5565\u5462\",\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.myway5.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\",\"name\":\"jiangpengfei\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"caption\":\"jiangpengfei\"},\"logo\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.myway5.com\/index.php\/author\/joyme\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"linux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp - \u4e00\u53ea\u5b89\u9759\u7684\u732b","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/","og_locale":"zh_CN","og_type":"article","og_title":"linux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp - \u4e00\u53ea\u5b89\u9759\u7684\u732b","og_description":"\u9996\u5148\u5728github\u4e0a\u4e0b\u8f7dmysql-connector-cpp git clone https:\/\/githu &hellip; \u7ee7\u7eed\u9605\u8bfblinux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp","og_url":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/","og_site_name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","article_published_time":"2017-04-19T09:43:19+00:00","article_modified_time":"2017-04-19T10:13:11+00:00","author":"jiangpengfei","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"jiangpengfei","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/#article","isPartOf":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/"},"author":{"name":"jiangpengfei","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"headline":"linux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp","datePublished":"2017-04-19T09:43:19+00:00","dateModified":"2017-04-19T10:13:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/"},"wordCount":133,"commentCount":0,"publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"articleSection":["linux"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/","url":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/","name":"linux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp - \u4e00\u53ea\u5b89\u9759\u7684\u732b","isPartOf":{"@id":"https:\/\/www.myway5.com\/#website"},"datePublished":"2017-04-19T09:43:19+00:00","dateModified":"2017-04-19T10:13:11+00:00","breadcrumb":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.myway5.com\/index.php\/2017\/04\/19\/linux-complier-mysql-connector-cpp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.myway5.com\/"},{"@type":"ListItem","position":2,"name":"linux\u4e0b\u7f16\u8bd1\u5b89\u88c5mysql-connector-cpp"}]},{"@type":"WebSite","@id":"https:\/\/www.myway5.com\/#website","url":"https:\/\/www.myway5.com\/","name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","description":"\u60f3\u5565\u5462","publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.myway5.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685","name":"jiangpengfei","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","caption":"jiangpengfei"},"logo":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/"},"url":"https:\/\/www.myway5.com\/index.php\/author\/joyme\/"}]}},"views":7458,"_links":{"self":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":1,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"predecessor-version":[{"id":47,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/46\/revisions\/47"}],"wp:attachment":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/tags?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}