{"id":4212,"date":"2019-05-06T17:56:57","date_gmt":"2019-05-06T09:56:57","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=4212"},"modified":"2019-05-06T17:56:57","modified_gmt":"2019-05-06T09:56:57","slug":"bat-%e5%bf%85%e9%97%ae%e7%9a%84-mysql-%e9%9d%a2%e8%af%95%e9%a2%98%e4%bd%a0%e9%83%bd%e4%bc%9a%e5%90%97%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=4212","title":{"rendered":"BAT \u5fc5\u95ee\u7684 MySQL \u9762\u8bd5\u9898\u4f60\u90fd\u4f1a\u5417\uff1f"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5c0f\u7a0b\u5e8f\u91cc\u7684\u9898\u5e93\u8d8a\u6765\u8d8a\u4e30\u5bcc\u4e86\uff0c\u6700\u8fd1\u4e0a\u65b0\u4e86\u4e0d\u5c11 MySQL \u9762\u8bd5\u9898\u3002\u5176\u4e2d\u6709\u4e00\u4e9b\u9762\u8bd5\u9898\u4e0d\u5e38\u89c1\uff0c\u4f46\u5374\u662f BAT \u5fc5\u95ee\u7684\u9762\u8bd5\u9898\u3002\u4eca\u5929\u6211\u62bd\u4e00\u4e9b\u9762\u8bd5\u9898\u8003\u8003\u5927\u5bb6\uff01<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1g2q9oab3ogj20ep08iaec.jpg\" alt=\"\" \/><figcaption>BAT MySQL \u9762\u8bd5\u9898\u5408\u96c6<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001MySQL \u4e2d\u7684 latin1 \u662f\u4ec0\u4e48\u5b57\u7b26\u96c6\uff1f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u5b57\u7b26\u96c6\u76f8\u4fe1\u5927\u5bb6\u90fd\u89c1\u8fc7\uff0c\u4e00\u822c\u5728\u521b\u5efa\u6570\u636e\u5e93\u7684\u65f6\u5019\u4f1a\u8fdb\u884c\u8bbe\u7f6e\u3002\u5b83\u5728 Java \u4e2d\u4ee3\u8868\u7684\u5c31\u662f ISO-8859-1\u3002\u5171\u6536\u5f55256\u4e2a\u5b57\u7b26\uff0c\u662f\u5728ASCII \u5b57\u7b26\u96c6\u7684\u57fa\u7840\u4e0a\u53c8\u6269\u5145\u4e86 128 \u4e2a\u897f\u6b27\u5e38\u7528\u5b57\u7b26(\u5305\u62ec\u5fb7\u6cd5\u4e24\u56fd\u7684\u5b57\u6bcd)\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 1 \u4e2a\u5b57\u8282\u6765\u8fdb\u884c\u7f16\u7801\u3002ISO-8859-1 \u8fd9\u4e2a\u5b57\u7b26\u96c6\u5728 MySQL \u4e2d\u7684\u522b\u540d\u5c31\u662f latin1\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u4e3a\u4ec0\u4e48\u6211\u4eec\u901a\u5e38\u63a8\u8350\u4f7f\u7528 utf8mb4 \u5b57\u7b26\u96c6\uff1f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u5f88\u591a\u6587\u7ae0\u90fd\u5199\u8fc7\uff0c\u8bf4\u4f7f\u7528 utf8 \u4f1a\u51fa\u95ee\u9898\uff0c\u6bd4\u5982\u5f53\u6211\u4eec\u5b58\u50a8 emoji \u8868\u60c5\u65f6\uff0c\u4f1a\u51fa\u73b0\u65e0\u6cd5\u5b58\u5165\u7684\u95ee\u9898\u3002\u4f46\u662f\u6ca1\u6709\u4eba\u4ece\u539f\u7406\u4e0a\u6765\u8bf4\u4e3a\u4ec0\u4e48\u4f1a\u4e22\u5931\u3002\u8fd9\u4e2a\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 SHOW CHARSET like &#8216;utf8%\u2019; \u547d\u4ee4\u67e5\u770b\u4e00\u4e0b utf8 \u548c utf8mb4 \u7684\u533a\u522b\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws4.sinaimg.cn\/large\/8fa5dcfcgy1g2rqvropbcj20ch04omxm.jpg\" alt=\"\" \/><figcaption>SHOW CHARSET like &#8216;utf8%&#8217;<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e4b\u6240\u4ee5\u65e0\u6cd5\u5b58\u50a8\u7684\u539f\u56e0\u5c31\u662f\uff0cUTF-8 \u7f16\u7801\u6709\u53ef\u80fd\u662f\u4e24\u4e2a\u3001\u4e09\u4e2a\u3001\u56db\u4e2a\u5b57\u8282\u3002Emoji \u8868\u60c5\u662f 4 \u4e2a\u5b57\u8282\uff0c\u800c Mysql \u7684 utf8 \u7f16\u7801\u6700\u591a 3 \u4e2a\u5b57\u8282\uff0c\u6240\u4ee5\u6570\u636e\u63d2\u4e0d\u8fdb\u53bb\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u8868 xttblog \u5b58\u5728\u4e14\u8be5\u8868\u4e2d\u4e0d\u5b58\u5728 name \u5b57\u6bb5\uff0c\u90a3\u4e48\u6267\u884c select * from xttblog where name = &#8216;\u4e1a\u4f59\u8349&#8217; \u80af\u5b9a\u4f1a\u62a5\u9519\uff0c\u8bf7\u95ee\u662f\u5728\u8fde\u63a5\u5668\uff0c\u5206\u6790\u5668\uff0c\u4f18\u5316\u5668\uff0c\u6267\u884c\u5668\u7b49\u54ea\u4e2a\u9636\u6bb5\u62a5\u9519\uff1f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u9898\u662f\u6211\u6628\u5929\u53d1\u5728\u5fae\u4fe1\u7fa4\u91cc\u7684\u4e00\u4e2a\u9898\uff0c\u5f88\u591a\u4eba\u7b54\u9519\u3002\u7b54\u6848\u662f\u5206\u6790\u5668\u3002\u56e0\u4e3a\uff0c\u8fde\u63a5\u5668\u662f\u8d1f\u8d23\u5904\u7406\u7ba1\u7406\u8fde\u63a5\uff0c\u6743\u9650\u9a8c\u8bc1\u7684\uff1b\u5206\u6790\u5668\u662f\u8fdb\u884c\u8bcd\u6cd5\u5206\u6790\uff0c\u8bed\u6cd5\u5206\u6790\u7684\uff1b\u4f18\u5316\u5668\u662f\u8fdb\u884c\u8bed\u53e5\u4f18\u5316\uff0c\u751f\u6210\u6267\u884c\u8ba1\u5212\uff0c\u9009\u62e9\u7d22\u5f15\u7684\uff1b\u6267\u884c\u5668\u662f\u771f\u6b63\u6267\u884c SQL \u8bed\u53e5\u7684\uff0c\u5e76\u8fd4\u56de\u7ed3\u679c\u96c6\u7684\u3002\u6240\u4ee5\uff0c\u56de\u7b54\u5206\u6790\u5668\u624d\u662f\u5bf9\u7684\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001MySQL 5.8 \u4e2d\u4e3a\u4ec0\u4e48\u628a\u67e5\u8be2\u7f13\u5b58\u8fd9\u4e00\u5757\u79fb\u9664\u4e86\uff1f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u67e5\u8be2\u7f13\u5b58\uff0c\u8fd9\u4e00\u5757\u4f30\u8ba1\u5f88\u591a\u4eba\u90fd\u6ca1\u6ce8\u610f\u5230\u3002\u65b0\u7248\u672c\u7684 5.8 \u7248\u672c\u7684 MySQL \u6570\u636e\u5e93\u5df2\u7ecf\u79fb\u9664\u4e86\u67e5\u8be2\u7f13\u5b58\u8fd9\u4e00\u5757\u7684\u8bbe\u8ba1\u3002\u800c\u4e14\u5728 5.7 \u7248\u672c\u4e2d\u4e5f\u4e0d\u63a8\u8350\u4f7f\u7528\u4e86\u3002\u79fb\u9664\u7684\u539f\u56e0\u662f\uff0c\u867d\u7136\u67e5\u8be2\u7f13\u5b58\u6709\u65f6\u5019\u80fd\u6bd4\u8f83\u5feb\u7684\u8fd4\u56de\u6570\u636e\uff0c\u4f46\u662f\u7ef4\u62a4\u8d77\u6765\u592a\u9ebb\u70e6\u4e86\u3002\u800c\u4e14\u7f13\u5b58\u547d\u4e2d\u7387\u592a\u4f4e\u4e86\u3002\u5982\u679c\u5bf9\u5e94\u7684\u8868\u6709 insert\u3001update\u3001delete \u7b49\uff0c\u90a3\u4e48\u7f13\u5b58\u5c31\u5f97\u5931\u6548\u3002\u5982\u679c\u67e5\u8be2\u8bed\u53e5\u4e2d\u6709\u51fd\u6570\uff0c\u5219\u653e\u5f03\u67e5\u8be2\u7f13\u5b58\u3002\u56e0\u4e3a\u51fd\u6570\u4f1a\u8bbe\u8ba1\u7684\u8ba1\u7b97\u7b49\u6709\u592a\u591a\u7684\u4e0d\u786e\u5b9a\u6027\u3002\u8fd8\u6709\u4e00\u4e9b\u51fd\u6570\u6839\u672c\u4e0d\u80fd\u7f13\u5b58\uff0c\u6216\u6ca1\u5fc5\u8981\u7f13\u5b58\u3002\u6bd4\u5982\uff0cselect now() \u5c31\u4e0d\u80fd\u7f13\u5b58\uff0c\u518d\u6bd4\u5982\uff0cselect version() \u5c31\u6ca1\u5fc5\u8981\u7f13\u5b58\u3002\u7efc\u5408\u8003\u8651\uff0cMySQL \u628a\u5b83\u7ed9\u79fb\u9664\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u66f4\u591a\u5173\u4e8e MySQL \u7684\u9762\u8bd5\u9898\uff0c\u53c2\u8003\u6211\u7684\u9762\u8bd5\u9898\u5c0f\u7a0b\u5e8f\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=4212\">BAT \u5fc5\u95ee\u7684 MySQL \u9762\u8bd5\u9898\u4f60\u90fd\u4f1a\u5417\uff1f<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u5c0f\u7a0b\u5e8f\u91cc\u7684\u9898\u5e93\u8d8a\u6765\u8d8a\u4e30\u5bcc\u4e86\uff0c\u6700\u8fd1\u4e0a\u65b0\u4e86\u4e0d\u5c11 MySQL \u9762\u8bd5\u9898\u3002\u5176\u4e2d\u6709\u4e00\u4e9b\u9762\u8bd5\u9898\u4e0d\u5e38\u89c1\uff0c\u4f46\u5374\u662f BAT \u5fc5\u95ee\u7684 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[1912,83,472,579,410],"class_list":["post-4212","post","type-post","status-publish","format-standard","hentry","category-sql","tag-bat","tag-mysql","tag-rest","tag-579","tag-410"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4212"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4212\/revisions"}],"predecessor-version":[{"id":4213,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/4212\/revisions\/4213"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}