{"id":2043,"date":"2020-07-29T23:23:31","date_gmt":"2020-07-29T15:23:31","guid":{"rendered":"http:\/\/39.97.231.10\/?p=2043"},"modified":"2020-07-29T23:23:31","modified_gmt":"2020-07-29T15:23:31","slug":"mysql%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b-%e5%ad%97%e7%ac%a6%e4%b8%b2%e6%9e%9a%e4%b8%be%e9%9b%86%e5%90%88","status":"publish","type":"post","link":"http:\/\/www.weijing.co\/?p=2043","title":{"rendered":"MySQL\u6570\u636e\u7c7b\u578b-\u5b57\u7b26\u4e32&amp;\u679a\u4e3e&amp;\u96c6\u5408"},"content":{"rendered":"<div class=\\\"blog_content\\\">\n<div class=\\\"blog_detail\\\">\n<div>\n\u5b57\u7b26\u4e32\u7c7b\u578b\u662fMySQL\u4f7f\u7528\u6700\u5e7f\u6cdb\u7684\u6570\u636e\u7c7b\u578b\u4e4b\u4e00\uff0c\u4e3b\u8981\u5305\u62ec\u56fa\u5b9a\u957f\u5ea6\u5b57\u7b26\u4e32\uff0c\u53d8\u957f\u5b57\u7b26\u4e32\uff0c\u5927\u6587\u672c\u5b57\u7b26\u4e32\uff0c\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\uff0c\u679a\u4e3e\uff0c\u96c6\u5408\u7b49\u3002<\/p>\n<h5>\u5b57\u7b26\u4e32\u7c7b\u578b\uff1a<\/h5>\n<ul>\n<li>CHAR<\/li>\n<li>VARCHAR<\/li>\n<li>BINARY<\/li>\n<li>VARBINARY<\/li>\n<li>TINYTEXT<\/li>\n<li>TEXT<\/li>\n<li>MEDIUMTEXT<\/li>\n<li>LONGTEXT<\/li>\n<li>TINYBLOB<\/li>\n<li>BLOB<\/li>\n<li>MEDIUMBLOB<\/li>\n<li>LONGBLOB<\/li>\n<li>ENUM<\/li>\n<li>SET<\/li>\n<\/ul>\n<p><strong>CHAR(M)\uff1a<\/strong><br \/>\n\u56fa\u5b9a\u957f\u5ea6\u5b57\u7b26\u4e32\uff0cM\u4e3a\u5b57\u7b26\u4e32\u957f\u5ea6\uff0c\u8303\u56f4\u4e3a0~255\u3002<br \/>\n<strong>VARCHAR(M)\uff1a<\/strong><br \/>\n\u53d8\u957f\u5b57\u7b26\u4e32\uff0cM\u4e3a\u5b57\u7b26\u4e32\u957f\u5ea6\uff0c\u8303\u56f4\u4e3a0~65535\uff0c\u5982\u679c\u4f7f\u7528utf8\uff0c\u4e00\u4e2a\u5b57\u7b26\u5360\u7528\u591a\u4e2a\u5b57\u8282\uff0c\u90a3\u4e48\u6700\u5927\u957f\u5ea6\u5c06\u5c0f\u4e8e65535\u3002<br \/>\n<strong>BINARY(M)\uff1a<\/strong><br \/>\n\u56fa\u5b9a\u957f\u5ea6\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\uff0cM\u4e3a\u5b57\u8282\u957f\u5ea6\u3002<br \/>\n<strong>VARBINARY(M)\uff1a<\/strong><br \/>\n\u53ef\u53d8\u957f\u5ea6\u7684\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\uff0cM\u4e3a\u5b57\u8282\u957f\u5ea6\u3002<br \/>\n<strong>TINYTEXT\uff1a<\/strong><br \/>\n\u5b57\u7b26\u4e32\uff0c\u6700\u5927255\u4e2a\u5b57\u8282\u3002<br \/>\n<strong>TEXT(M)\uff1a<\/strong><br \/>\n\u5b57\u7b26\u4e32\uff0c\u6700\u592765535\u4e2a\u5b57\u7b26\uff0cM\u4e3a\u5b57\u7b26\u4e32\u957f\u5ea6\u3002<br \/>\n<strong>MEDIUMTEXT\uff1a<\/strong><br \/>\n\u5b57\u7b26\u4e32\uff0c\u6700\u592716777215\u4e2a\u5b57\u7b26\u3002<br \/>\n<strong>LONGTEXT\uff1a<\/strong><br \/>\n\u5b57\u7b26\u4e32\uff0c\u6700\u59274294967295\u4e2a\u5b57\u7b26\u3002<br \/>\n<strong>TINYBLOB\uff1a<\/strong><br \/>\n\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\uff0c\u6700\u5927255\u4e2a\u5b57\u8282\u3002<br \/>\n<strong>BLOB(M)\uff1a<\/strong><br \/>\n\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\uff0c\u6700\u592765535\u4e2a\u5b57\u8282\uff0cM\u4e3a\u5b57\u8282\u957f\u5ea6\u3002<br \/>\n<strong>MEDIUMBLOB\uff1a<\/strong><br \/>\n\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\uff0c\u6700\u592716777215\u4e2a\u5b57\u8282\u3002<br \/>\n<strong>LONGBLOB\uff1a<\/strong><br \/>\n\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\uff0c\u6700\u59274294967295\u4e2a\u5b57\u8282\u3002<br \/>\n<strong>ENUM\uff1a<\/strong><br \/>\n\u679a\u4e3e\u7c7b\u578b\uff0c\u6700\u5927\u53ef\u4ee5\u670965535\u4e2a\u4e0d\u540c\u7684\u5143\u7d20\u3002<br \/>\n\u793a\u4f8b\uff1a<br \/>\ncreate table t8(id enum(\\&#8217;green\\&#8217;,\\&#8217;blue\\&#8217;,\\&#8217;red\\&#8217;));<br \/>\ninsert into t8 select \\&#8217;red\\&#8217;;<br \/>\n<strong>SET\uff1a<\/strong><br \/>\n\u96c6\u5408\u7c7b\u578b\uff0c\u6700\u5927\u53ef\u4ee5\u670964\u4e2a\u4e0d\u540c\u7684\u5143\u7d20\u3002<br \/>\ncreate table t9(id set(\\&#8217;red\\&#8217;,\\&#8217;blue\\&#8217;,\\&#8217;green\\&#8217;));<br \/>\ninsert into t9 select \\&#8217;red,green\\&#8217;;<\/p>\n<h5>\u5b57\u7b26\u6821\u9a8c\u89c4\u5219\uff1a<\/h5>\n<p>CHAR,VARCHAR,TEXT,ENUM,SET\u80fd\u591f\u6307\u5b9a\u5b57\u7b26\u96c6\u548c\u6821\u9a8c\u89c4\u5219\uff0c\u8fd9\u4e9b\u7c7b\u578b\u5b9a\u4e49\u7684\u957f\u5ea6\u662f\u5b57\u7b26\u957f\u5ea6\uff0c\u5e76\u4e0d\u662f\u6240\u5360\u7684\u5b57\u8282\u957f\u5ea6\u3002<br \/>\n\u5b57\u7b26\u6bd4\u8f83\u548c\u6392\u5e8f\u4f9d\u8d56\u4e8e\u6821\u9a8c\u89c4\u5219\uff0c\u6bd4\u5982\u662f\u5426\u5927\u5c0f\u5199\u654f\u611f\uff0c\u4ece\u6821\u9a8c\u89c4\u5219\u7684\u540d\u79f0\u5c31\u80fd\u770b\u51fa\u3002<\/p>\n<ul>\n<li>cs \u8868\u793a\u5927\u5c0f\u5199\u654f\u611f\uff0ccase-sensitive<\/li>\n<li>ci \u8868\u793a\u5927\u5c0f\u5199\u4e0d\u654f\u611f\uff0ccase-insensitive<\/li>\n<li>bin \u8868\u793a\u4e8c\u8fdb\u5236\u5f62\u5f0f\u6821\u9a8c<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><br \/>\n\u6307\u5b9a\u8868\u7684\u5b57\u7b26\u96c6\u548c\u6821\u9a8c\u89c4\u5219\uff1a<br \/>\ncreate table t12(id varchar(50)) CHARACTER SET utf8mb4, COLLATE utf8mb4_bin;<br \/>\n\u6307\u5b9a\u5b57\u6bb5\u7684\u5b57\u7b26\u96c6\u548c\u6821\u9a8c\u89c4\u5219\uff1a<br \/>\ncreate table t13(id varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin);\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5b57\u7b26\u4e32\u7c7b\u578b\u662fMySQL\u4f7f\u7528\u6700\u5e7f\u6cdb\u7684\u6570\u636e\u7c7b\u578b\u4e4b\u4e00\uff0c\u4e3b\u8981\u5305\u62ec\u56fa\u5b9a\u957f\u5ea6\u5b57\u7b26\u4e32\uff0c\u53d8\u957f\u5b57\u7b26\u4e32\uff0c\u5927\u6587\u672c\u5b57\u7b26\u4e32\uff0c\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32 &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.weijing.co\/?p=2043\"> <span class=\"screen-reader-text\">MySQL\u6570\u636e\u7c7b\u578b-\u5b57\u7b26\u4e32&amp;\u679a\u4e3e&amp;\u96c6\u5408<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[90,88],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"mailpoet_newsletter_max":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false,"shop_catalog":false,"shop_single":false,"shop_thumbnail":false},"uagb_author_info":{"display_name":"weijing","author_link":"http:\/\/www.weijing.co\/?author=4"},"uagb_comment_info":0,"uagb_excerpt":"\u5b57\u7b26\u4e32\u7c7b\u578b\u662fMySQL\u4f7f\u7528\u6700\u5e7f\u6cdb\u7684\u6570\u636e\u7c7b\u578b\u4e4b\u4e00\uff0c\u4e3b\u8981\u5305\u62ec\u56fa\u5b9a\u957f\u5ea6\u5b57\u7b26\u4e32\uff0c\u53d8\u957f\u5b57\u7b26\u4e32\uff0c\u5927\u6587\u672c\u5b57\u7b26\u4e32\uff0c\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32&hellip;","_links":{"self":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/2043"}],"collection":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2043"}],"version-history":[{"count":0,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/2043\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2043"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}