{"id":98,"date":"2017-09-04T10:40:13","date_gmt":"2017-09-04T02:40:13","guid":{"rendered":"http:\/\/www.buyige.net\/?p=98"},"modified":"2017-09-04T10:40:13","modified_gmt":"2017-09-04T02:40:13","slug":"mysql%e6%8f%92%e5%85%a5%e6%95%b0%e6%8d%ae%ef%bc%8c%e8%8e%ab%e5%90%8d%e5%85%b6%e5%a6%99%e7%9a%84%e4%b9%b1%e7%a0%81","status":"publish","type":"post","link":"https:\/\/www.buyige.net\/?p=98","title":{"rendered":"MySQL\u63d2\u5165\u6570\u636e\uff0c\u83ab\u540d\u5176\u5999\u7684\u4e71\u7801"},"content":{"rendered":"<p>\u63a5\u89e6\u6570\u636e\u5e93\u6bd4\u8f83\u5c11\uff0c\u5bf9\u6570\u636e\u5e93\u5f88\u591a\u7279\u6027\u5e76\u4e0d\u662f\u5f88\u4e86\u89e3\uff0c\u6240\u4ee5\u5c31\u5728\u6570\u636e\u5e93\u4e0a\u7528\u4e86\u5f88\u591a\u7684\u65f6\u95f4\uff0c\u6bd4\u8f83\u5934\u75bc\u7684\u5c31\u662f\u6570\u636e\u5e93\u7684\u4e2d\u6587\u4e71\u7801\u95ee\u9898\u4e86\uff0c\u5173\u4e8e\u5efa\u8868\u548c\u5efa\u5e93\u8fc7\u7a0b\u4e2d\u6307\u5b9autf8\u8fd9\u6837\u7684\u64cd\u4f5c\uff0c\u662f\u5f88\u6b63\u5e38\u7684\u5728\u7f51\u4e0a\u4e5f\u53ef\u4ee5\u8f7b\u677e\u627e\u5230\u76f8\u5173\u7684\u8d44\u6599\u6216\u8005\u6559\u7a0b\u3002\u6211\u8fd9\u4e2a\u8981\u8bf4\u7684\u662f\u4e00\u4e2a\u6bd4\u8f83\u5947\u8469\u7684\u60c5\u51b5\u3002<\/p>\n<p>\u8fd9\u91cc\u5148\u770b\u4e0b\u51e0\u4e2a\u91cd\u8981\u7684\u70b9\uff0c\u5728mysql\u547d\u4ee4\u884c\u4e2dshow variables like &#8216;character%&#8217;;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-99\" src=\"http:\/\/www.buyige.net\/wp-content\/uploads\/2017\/09\/QQ\u622a\u56fe20170904102631.png\" alt=\"\" width=\"645\" height=\"240\" srcset=\"https:\/\/www.buyige.net\/wp-content\/uploads\/2017\/09\/QQ\u622a\u56fe20170904102631.png 645w, https:\/\/www.buyige.net\/wp-content\/uploads\/2017\/09\/QQ\u622a\u56fe20170904102631-300x112.png 300w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/>\u5168\u90e8UTF8\u6ca1\u6709\u4efb\u4f55\u95ee\u9898\uff0c\u5728\u770b\u8fd9\u91cc<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-100\" src=\"http:\/\/www.buyige.net\/wp-content\/uploads\/2017\/09\/QQ\u622a\u56fe20170904102821.png\" alt=\"\" width=\"651\" height=\"489\" srcset=\"https:\/\/www.buyige.net\/wp-content\/uploads\/2017\/09\/QQ\u622a\u56fe20170904102821.png 651w, https:\/\/www.buyige.net\/wp-content\/uploads\/2017\/09\/QQ\u622a\u56fe20170904102821-300x225.png 300w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-101\" src=\"http:\/\/www.buyige.net\/wp-content\/uploads\/2017\/09\/QQ\u622a\u56fe20170904102830.png\" alt=\"\" width=\"609\" height=\"465\" srcset=\"https:\/\/www.buyige.net\/wp-content\/uploads\/2017\/09\/QQ\u622a\u56fe20170904102830.png 609w, https:\/\/www.buyige.net\/wp-content\/uploads\/2017\/09\/QQ\u622a\u56fe20170904102830-300x229.png 300w\" sizes=\"auto, (max-width: 609px) 100vw, 609px\" \/><\/p>\n<p>\u4e24\u4e2a\u8868\u7684\u6570\u636e\u7c7b\u578b\u90fd\u662fvarchar\u5b57\u7b26\u96c6\u90fd\u662futf8\u6ca1\u95ee\u9898\uff0c\u4f46\u662f\u5c31\u662f\u4e00\u4e2a\u53ef\u4ee5\u6b63\u5e38\u4e2d\u6587\uff0c\u53e6\u5916\u4e00\u4e2a\u4e00\u76f4\u90fd\u662f\u4e71\u7801\u3002\u5728\u8fd9\u5c31\u5f97\u8bf4\uff0c\u95ee\u9898\u8fd8\u662f\u5f97\u627e\u6839\u672c\uff0c\u6211\u60f3\u4e86\u591a\u79cd\u65b9\u6cd5\u53bb\u89e3\u51b3\uff0c\u7edf\u7edf\u6ca1\u6709\u6548\u679c\uff0c\u6700\u540e\u5b9e\u5728\u6ca1\u6709\u6548\u679c\uff0c\u53ea\u80fd\u5230\u5904\u5efa\u8868sql\uff0c\u8fd9\u91cc\u5c31\u53d1\u73b0\u95ee\u9898\u4e86\u3002<\/p>\n<p>&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nDROP TABLE IF EXISTS `testcode`;<br \/>\nCREATE TABLE `testcode` (<br \/>\n`id` int(11) NOT NULL AUTO_INCREMENT,<br \/>\n`remote_id` int(11) NOT NULL,<br \/>\n`type` varchar(255) NOT NULL,<br \/>\nPRIMARY KEY (`remote_id`,`id`),<br \/>\nKEY `id` (`id`) USING BTREE<br \/>\n) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;<\/p>\n<p>&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n&#8212; Table structure for testobject<br \/>\n&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nDROP TABLE IF EXISTS `testobject`;<br \/>\nCREATE TABLE `testobject` (<br \/>\n`id` int(11) NOT NULL AUTO_INCREMENT,<br \/>\n`obj_id` int(11) NOT NULL,<br \/>\n`remote_id` int(11) NOT NULL,<br \/>\n`object` varchar(255) CHARACTER SET latin1 DEFAULT NULL,<br \/>\n`type` varchar(255) CHARACTER SET latin1 DEFAULT NULL,<br \/>\n`model` varchar(255) CHARACTER SET latin1 DEFAULT NULL,<br \/>\n`standard` float DEFAULT NULL,<br \/>\nPRIMARY KEY (`id`,`obj_id`)<br \/>\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;<\/p>\n<p>&nbsp;<\/p>\n<p>\u8fd9\u91cc\u770b\u5230\u6709CHARACTER SET latin1\u8fd9\u6837\u7684\u5b57\u6837\uff0c\u4f46\u662f\u5728\u7ba1\u7406\u8f6f\u4ef6\u91cc\u7edf\u7edf\u662f\u770b\u4e0d\u5230\u8fd9\u4e2a\u7684\uff0c\u53ea\u80fd\u5728sql\u91cc\u770b\u5230\u3002\u627e\u5230\u95ee\u9898\u4e86\u5c31\u597d\u89e3\u51b3\uff0c\u53ea\u9700\u8981\u5220\u9664CHARACTER SET latin1\uff0c\u7136\u540e\u518ddrop table\uff0c\u63a5\u7740create\u5c31\u884c\u3002\u8fd9\u4e2a\u95ee\u9898\u6240\u793a\u89e3\u51b3\u4e86\u3002\u8fd9\u4e2a\u95ee\u9898\u4ea7\u751f\u7684\u539f\u56e0\u5e94\u8be5\u5c31\u662f\u5728\u5efa\u8868\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6ca1\u6709\u6307\u5b9autf8 \uff0c\u540e\u8fb9\u6539\u7684utf8.\u9020\u6210\u6570\u636e\u7c7b\u578b\u7684\u4e0d\u7edf\u4e00\u624d\u9020\u6210\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a5\u89e6\u6570\u636e\u5e93\u6bd4\u8f83\u5c11\uff0c\u5bf9\u6570\u636e\u5e93\u5f88\u591a\u7279\u6027\u5e76\u4e0d\u662f\u5f88\u4e86\u89e3\uff0c\u6240\u4ee5\u5c31\u5728\u6570\u636e\u5e93\u4e0a\u7528\u4e86\u5f88\u591a\u7684\u65f6\u95f4\uff0c\u6bd4\u8f83\u5934\u75bc\u7684\u5c31\u662f\u6570\u636e\u5e93\u7684\u4e2d\u6587\u4e71\u7801 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-98","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.buyige.net\/index.php?rest_route=\/wp\/v2\/posts\/98","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.buyige.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.buyige.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.buyige.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.buyige.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=98"}],"version-history":[{"count":1,"href":"https:\/\/www.buyige.net\/index.php?rest_route=\/wp\/v2\/posts\/98\/revisions"}],"predecessor-version":[{"id":102,"href":"https:\/\/www.buyige.net\/index.php?rest_route=\/wp\/v2\/posts\/98\/revisions\/102"}],"wp:attachment":[{"href":"https:\/\/www.buyige.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=98"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.buyige.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=98"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.buyige.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}