{"id":177215,"date":"2024-11-08T14:18:19","date_gmt":"2024-11-08T06:18:19","guid":{"rendered":"https:\/\/server.hk\/cnblog\/177215\/"},"modified":"2024-11-08T14:18:20","modified_gmt":"2024-11-08T06:18:20","slug":"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9mysql%e9%8c%af%e8%aa%a41097-sql%e7%8b%80%e6%85%8b%ef%bc%9ahy000%ef%bc%88er_too_big_set%ef%bc%89%e5%b0%8d%e6%96%bc%e5%88%97s%e5%92%8cset%ef%bc%8c%e5%ad%97%e7%ac%a6","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/177215\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9MySQL\u932f\u8aa41097 &#8211; SQL\u72c0\u614b\uff1aHY000\uff08ER_TOO_BIG_SET\uff09\u5c0d\u65bc\u5217%s\u548cSET\uff0c\u5b57\u7b26\u4e32\u904e\u591a"},"content":{"rendered":"<h1 id=\"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9mysql%e9%8c%af%e8%aa%a41097-sql%e7%8b%80%e6%85%8b%ef%bc%9ahy000%ef%bc%88er_too_big_set%ef%bc%89%e5%b0%8d%e6%96%bc%e5%88%97s%e5%92%8cset%ef%bc%8c%e5%ad%97%e7%ac%a6-nYegcESLra\">\u5982\u4f55\u4fee\u5fa9MySQL\u932f\u8aa41097 &#8211; SQL\u72c0\u614b\uff1aHY000\uff08ER_TOO_BIG_SET\uff09\u5c0d\u65bc\u5217%s\u548cSET\uff0c\u5b57\u7b26\u4e32\u904e\u591a<\/h1>\n<p>\u5728\u4f7f\u7528MySQL\u6578\u64da\u5eab\u6642\uff0c\u958b\u767c\u8005\u53ef\u80fd\u6703\u9047\u5230\u5404\u7a2e\u932f\u8aa4\uff0c\u5176\u4e2d\u4e4b\u4e00\u5c31\u662f\u932f\u8aa41097\uff0c\u8a72\u932f\u8aa4\u7684SQL\u72c0\u614b\u70baHY000\uff0c\u4e26\u4e14\u63d0\u793a\u201cER_TOO_BIG_SET\u201d\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u767c\u751f\u5728\u4f7f\u7528SET\u985e\u578b\u7684\u5217\u6642\uff0c\u7576\u63d2\u5165\u7684\u5b57\u7b26\u4e32\u904e\u591a\uff0c\u8d85\u51fa\u4e86MySQL\u7684\u9650\u5236\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u9019\u500b\u932f\u8aa4\u7684\u539f\u56e0\u53ca\u5176\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n<h2 id=\"%e9%8c%af%e8%aa%a41097%e7%9a%84%e5%8e%9f%e5%9b%a0-nYegcESLra\">\u932f\u8aa41097\u7684\u539f\u56e0<\/h2>\n<p>MySQL\u4e2d\u7684SET\u6578\u64da\u985e\u578b\u5141\u8a31\u7528\u6236\u5728\u4e00\u500b\u5217\u4e2d\u5b58\u5132\u591a\u500b\u503c\u3002\u6bcf\u500bSET\u503c\u90fd\u662f\u4e00\u500b\u5b57\u7b26\u4e32\uff0c\u4e26\u4e14\u53ef\u4ee5\u5305\u542b\u591a\u500b\u9078\u9805\u3002\u6839\u64daMySQL\u7684\u6587\u6a94\uff0cSET\u985e\u578b\u7684\u6700\u5927\u503c\u6578\u91cf\u70ba64\u500b\uff0c\u9019\u610f\u5473\u8457\u5982\u679c\u4f60\u5617\u8a66\u63d2\u5165\u7684\u5b57\u7b26\u4e32\u8d85\u904e\u4e86\u9019\u500b\u9650\u5236\uff0c\u5c31\u6703\u5f15\u767c\u932f\u8aa41097\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5047\u8a2d\u4f60\u6709\u4e00\u500b\u540d\u70ba`status`\u7684SET\u5217\uff0c\u5b9a\u7fa9\u5982\u4e0b\uff1a<\/p>\n<pre><code>CREATE TABLE example (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    status SET('active', 'inactive', 'pending', 'suspended', 'deleted')\n);<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u5617\u8a66\u63d2\u5165\u4e00\u500b\u5305\u542b\u8d85\u904e64\u500b\u9078\u9805\u7684\u5b57\u7b26\u4e32\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code>INSERT INTO example (status) VALUES ('active, inactive, pending, suspended, deleted, ...');<\/code><\/pre>\n<p>\u9019\u5c07\u5c0e\u81f4\u932f\u8aa41097\u7684\u767c\u751f\u3002<\/p>\n<h2 id=\"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9%e9%8c%af%e8%aa%a41097-nYegcESLra\">\u5982\u4f55\u4fee\u5fa9\u932f\u8aa41097<\/h2>\n<p>\u8981\u4fee\u5fa9\u9019\u500b\u932f\u8aa4\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u8003\u616e\u4ee5\u4e0b\u5e7e\u7a2e\u65b9\u6cd5\uff1a<\/p>\n<h3 id=\"1-%e6%aa%a2%e6%9f%a5%e6%8f%92%e5%85%a5%e7%9a%84%e6%95%b8%e6%93%9a-nYegcESLra\">1. \u6aa2\u67e5\u63d2\u5165\u7684\u6578\u64da<\/h3>\n<p>\u9996\u5148\uff0c\u6aa2\u67e5\u4f60\u5617\u8a66\u63d2\u5165\u7684\u6578\u64da\uff0c\u78ba\u4fdd\u5b83\u4e0d\u8d85\u904eSET\u985e\u578b\u7684\u9650\u5236\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8a62\u4f86\u6aa2\u67e5\u7576\u524d\u7684\u6578\u64da\uff1a<\/p>\n<pre><code>SELECT * FROM example;<\/code><\/pre>\n<p>\u5982\u679c\u767c\u73fe\u67d0\u4e00\u884c\u7684`status`\u5217\u5305\u542b\u904e\u591a\u7684\u9078\u9805\uff0c\u5247\u9700\u8981\u9032\u884c\u8abf\u6574\u3002<\/p>\n<h3 id=\"2-%e7%b0%a1%e5%8c%96set%e9%81%b8%e9%a0%85-nYegcESLra\">2. \u7c21\u5316SET\u9078\u9805<\/h3>\n<p>\u5982\u679c\u4f60\u7684\u61c9\u7528\u7a0b\u5e8f\u9700\u8981\u5b58\u5132\u7684\u9078\u9805\u8d85\u904e\u4e8664\u500b\uff0c\u8003\u616e\u7c21\u5316SET\u9078\u9805\u3002\u4f60\u53ef\u4ee5\u5c07\u67d0\u4e9b\u9078\u9805\u5408\u4f75\uff0c\u6216\u8005\u4f7f\u7528\u5176\u4ed6\u6578\u64da\u985e\u578b\u4f86\u5b58\u5132\u9019\u4e9b\u503c\uff0c\u4f8b\u5982\u4f7f\u7528\u4e00\u500b\u95dc\u806f\u8868\u4f86\u5b58\u5132\u591a\u5c0d\u591a\u7684\u95dc\u4fc2\u3002<\/p>\n<h3 id=\"3-%e4%bd%bf%e7%94%a8%e5%85%b6%e4%bb%96%e6%95%b8%e6%93%9a%e9%a1%9e%e5%9e%8b-nYegcESLra\">3. \u4f7f\u7528\u5176\u4ed6\u6578\u64da\u985e\u578b<\/h3>\n<p>\u5982\u679cSET\u985e\u578b\u4e0d\u9069\u5408\u4f60\u7684\u9700\u6c42\uff0c\u8003\u616e\u4f7f\u7528\u5176\u4ed6\u6578\u64da\u985e\u578b\uff0c\u4f8b\u5982VARCHAR\u6216TEXT\u3002\u9019\u6a23\u53ef\u4ee5\u907f\u514d\u56e0\u70ba\u9078\u9805\u904e\u591a\u800c\u5c0e\u81f4\u7684\u932f\u8aa4\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>CREATE TABLE example (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    status VARCHAR(255)\n);<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u9017\u865f\u5206\u9694\u7684\u5b57\u7b26\u4e32\u4f86\u5b58\u5132\u591a\u500b\u72c0\u614b\u3002<\/p>\n<h3 id=\"4-%e6%9b%b4%e6%96%b0mysql%e7%89%88%e6%9c%ac-nYegcESLra\">4. \u66f4\u65b0MySQL\u7248\u672c<\/h3>\n<p>\u5728\u67d0\u4e9b\u60c5\u6cc1\u4e0b\uff0c\u66f4\u65b0MySQL\u5230\u6700\u65b0\u7248\u672c\u53ef\u80fd\u6703\u89e3\u6c7a\u4e00\u4e9b\u6f5b\u5728\u7684\u554f\u984c\u3002\u78ba\u4fdd\u4f60\u7684\u6578\u64da\u5eab\u904b\u884c\u5728\u6700\u65b0\u7684\u7a69\u5b9a\u7248\u672c\u4e0a\uff0c\u4ee5\u7372\u5f97\u6700\u4f73\u6027\u80fd\u548c\u517c\u5bb9\u6027\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-nYegcESLra\">\u7e3d\u7d50<\/h2>\n<p>MySQL\u932f\u8aa41097\uff08HY000\uff09\u901a\u5e38\u662f\u7531\u65bcSET\u5217\u4e2d\u63d2\u5165\u7684\u5b57\u7b26\u4e32\u904e\u591a\u800c\u5f15\u8d77\u7684\u3002\u901a\u904e\u6aa2\u67e5\u63d2\u5165\u7684\u6578\u64da\u3001\u7c21\u5316SET\u9078\u9805\u3001\u8003\u616e\u4f7f\u7528\u5176\u4ed6\u6578\u64da\u985e\u578b\u4ee5\u53ca\u66f4\u65b0MySQL\u7248\u672c\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u89e3\u6c7a\u9019\u500b\u554f\u984c\u3002\u5c0d\u65bc\u9700\u8981\u7a69\u5b9a\u548c\u9ad8\u6548\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\u7684\u7528\u6236\uff0c\u9078\u64c7\u5408\u9069\u7684<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u6216<a href=\"https:\/\/server.hk\">\u96f2\u4f3a\u670d\u5668<\/a>\u53ef\u4ee5\u63d0\u4f9b\u66f4\u597d\u7684\u652f\u6301\u548c\u6027\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4fee\u5fa9MySQL\u932f\u8aa41097\uff08HY000\uff09\u7684\u65b9\u6cd5\uff0c\u89e3\u6c7aSET\u5217\u4e2d\u5b57\u7b26\u4e32\u904e\u591a\u7684\u554f\u984c\uff0c\u78ba\u4fdd\u6578\u64da\u5eab\u6b63\u5e38\u904b\u884c\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-177215","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/177215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=177215"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/177215\/revisions"}],"predecessor-version":[{"id":177216,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/177215\/revisions\/177216"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=177215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=177215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=177215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}