{"id":25961,"date":"2024-11-24T15:21:02","date_gmt":"2024-11-24T07:21:02","guid":{"rendered":"https:\/\/fwq.ai\/blog\/25961\/"},"modified":"2024-11-24T15:21:02","modified_gmt":"2024-11-24T07:21:02","slug":"mysql-%e6%94%af%e6%8c%81%e7%b4%a2%e5%bc%95%e5%93%aa%e4%ba%9b%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/25961\/","title":{"rendered":"MySQL \u652f\u6301\u7d22\u5f15\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173076678326978.jpg\" class=\"aligncenter\" title=\"MySQL \u652f\u6301\u7d22\u5f15\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\uff1f\u63d2\u56fe\" alt=\"MySQL \u652f\u6301\u7d22\u5f15\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u652f\u6301\u7684\u7d22\u5f15\u5b57\u6bb5\u7c7b\u578b<\/strong><\/p>\n<p>\u5728mysql\u4e2d\uff0c\u51e0\u4e4e\u6240\u6709\u6570\u636e\u7c7b\u578b\u90fd\u53ef\u4ee5\u5efa\u7acb\u7d22\u5f15\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li> <strong>\u6574\u6570\u7c7b\u578b\uff1a<\/strong> int\u3001tinyint\u3001smallint\u3001bigint\u3001bit<\/li>\n<li> <strong>\u6d6e\u70b9\u7c7b\u578b\uff1a<\/strong> float\u3001double\u3001real<\/li>\n<li> <strong>\u65e5\u671f\u548c\u65f6\u95f4\u7c7b\u578b\uff1a<\/strong> date\u3001time\u3001datetime\u3001timestamp<\/li>\n<li> <strong>\u5b57\u7b26\u7c7b\u578b\uff1a<\/strong> char\u3001varchar\u3001text\u3001blob<\/li>\n<li> <strong>decimal\u7c7b\u578b\uff1a<\/strong> decimal\u3001numeric<\/li>\n<\/ul>\n<p><strong>text\u548cblob\u7c7b\u578b\u7684\u7d22\u5f15<\/strong><\/p>\n<p>text\u548cblob\u7c7b\u578b\u5b57\u6bb5\u4e5f\u53ef\u4ee5\u8fdb\u884c\u7d22\u5f15\uff0c\u4f46\u9700\u8981\u6307\u5b9a\u524d\u7f00\u957f\u5ea6\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>CREATE TABLE test (\n    blob_col BLOB,\n    INDEX(blob_col(10))\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u524d\u7f00\u957f\u5ea6\u6700\u591a\u53ef\u4ee5\u662f1000\u5b57\u8282\uff08\u5bf9\u4e8einnodb\u8868\u662f767\u5b57\u8282\uff0c\u9664\u975e\u8bbe\u7f6e\u4e86innodb_large_prefix\uff09\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fMySQL \u652f\u6301\u7d22\u5f15\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u652f\u6301\u7684\u7d22\u5f15\u5b57\u6bb5\u7c7b\u578b \u5728mysql\u4e2d\uff0c\u51e0\u4e4e\u6240\u6709\u6570\u636e\u7c7b\u578b\u90fd\u53ef\u4ee5\u5efa\u7acb\u7d22\u5f15\uff0c\u5305\u62ec\uff1a \u6574\u6570\u7c7b\u578b\uff1a int\u3001tinyint\u3001smallint\u3001bigint\u3001bit \u6d6e\u70b9\u7c7b\u578b\uff1a float\u3001double\u3001real \u65e5\u671f\u548c\u65f6\u95f4\u7c7b\u578b\uff1a date\u3001time\u3001datetime\u3001timestamp \u5b57\u7b26\u7c7b\u578b\uff1a char\u3001varchar\u3001text\u3001blob decimal\u7c7b\u578b\uff1a decimal\u3001numeric text\u548cblob\u7c7b\u578b\u7684\u7d22\u5f15 text\u548cblob\u7c7b\u578b\u5b57\u6bb5\u4e5f\u53ef\u4ee5\u8fdb\u884c\u7d22\u5f15\uff0c\u4f46\u9700\u8981\u6307\u5b9a\u524d\u7f00\u957f\u5ea6\u3002\u4f8b\u5982\uff1a CREATE TABLE test ( blob_col BLOB, INDEX(blob_col(10)) ); \u767b\u5f55\u540e\u590d\u5236 \u524d\u7f00\u957f\u5ea6\u6700\u591a\u53ef\u4ee5\u662f1000\u5b57\u8282\uff08\u5bf9\u4e8einnodb\u8868\u662f767\u5b57\u8282\uff0c\u9664\u975e\u8bbe\u7f6e\u4e86innodb_large_prefix\uff09\u3002 \u4ee5\u4e0a\u5c31\u662fMySQL \u652f\u6301\u7d22\u5f15\u54ea\u4e9b\u6570\u636e\u7c7b\u578b\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-25961","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=25961"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25961\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=25961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=25961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=25961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}