{"id":6973,"date":"2024-11-14T11:02:22","date_gmt":"2024-11-14T03:02:22","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6973\/"},"modified":"2024-11-14T11:02:22","modified_gmt":"2024-11-14T03:02:22","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-utf8mb4-%e6%a0%a1%e5%af%b9%e9%9b%86%e5%88%a0%e9%99%a4%e4%b8%a4%e4%b8%aa%e8%a1%a8%e4%b8%ad%e5%8c%b9%e9%85%8d%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6973\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 UTF8MB4 \u6821\u5bf9\u96c6\u5220\u9664\u4e24\u4e2a\u8868\u4e2d\u5339\u914d\u7684\u5185\u5bb9\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173020293616219.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528 UTF8MB4 \u6821\u5bf9\u96c6\u5220\u9664\u4e24\u4e2a\u8868\u4e2d\u5339\u914d\u7684\u5185\u5bb9\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528 UTF8MB4 \u6821\u5bf9\u96c6\u5220\u9664\u4e24\u4e2a\u8868\u4e2d\u5339\u914d\u7684\u5185\u5bb9\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u6c42\u89e3\u591a\u8868\u6570\u636e\u5220\u9664\u8bed\u53e5<\/strong><\/p>\n<p>\u5982\u4f55\u5220\u9664\u4e24\u4e2a\u8868\u4e2d\u6307\u5b9a\u5185\u5bb9\u7684\u6570\u636e\uff1f\u8fd9\u9700\u8981\u4f7f\u7528 utf8mb4 \u6821\u5bf9\u96c6\u8fdb\u884c\u6bd4\u8f83\u5e76\u5220\u9664\u5339\u914d\u7684\u6570\u636e\u3002<\/p>\n<p>\u5bf9\u4e8e\u5355\u8868\u7684\u6570\u636e\u5220\u9664\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u53e5\uff1a<\/p>\n<pre>delete from t1 where convert(username using utf8mb4) = convert(username using utf8mb4);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5bf9\u4e8e\u591a\u8868\u4e2d\u7684\u6570\u636e\u5220\u9664\uff0c\u53ef\u4ee5\u53c2\u8003  \u6587\u6863\u4e2d delete \u8bed\u53e5\u7684\u591a\u8868\u8bed\u6cd5\uff1a<\/p>\n<pre>delete [low_priority] [quick] [ignore]\nfrom table_references\n[where where_condition]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d table_references \u6307\u5b9a\u53c2\u4e0e\u5220\u9664\u64cd\u4f5c\u7684\u8868\uff0cwhere_condition \u6307\u5b9a\u5220\u9664\u6761\u4ef6\u3002<\/p>\n<p><strong>sql \u8bed\u53e5\u8303\u4f8b\uff1a<\/strong><\/p>\n<pre>DELETE FROM t1, t2\nWHERE CONVERT(t1.username USING utf8mb4) = CONVERT(t2.username USING utf8mb4);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528 UTF8MB4 \u6821\u5bf9\u96c6\u5220\u9664\u4e24\u4e2a\u8868\u4e2d\u5339\u914d\u7684\u5185\u5bb9\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6c42\u89e3\u591a\u8868\u6570\u636e\u5220\u9664\u8bed\u53e5 \u5982\u4f55\u5220\u9664\u4e24\u4e2a\u8868\u4e2d\u6307\u5b9a\u5185\u5bb9\u7684\u6570\u636e\uff1f\u8fd9\u9700\u8981\u4f7f\u7528 utf8mb4 \u6821\u5bf9\u96c6\u8fdb\u884c\u6bd4\u8f83\u5e76\u5220\u9664\u5339\u914d\u7684\u6570\u636e\u3002 \u5bf9\u4e8e\u5355\u8868\u7684\u6570\u636e\u5220\u9664\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u53e5\uff1a delete from t1 where convert(username using utf8mb4) = convert(username using utf8mb4); \u767b\u5f55\u540e\u590d\u5236 \u5bf9\u4e8e\u591a\u8868\u4e2d\u7684\u6570\u636e\u5220\u9664\uff0c\u53ef\u4ee5\u53c2\u8003 \u6587\u6863\u4e2d delete \u8bed\u53e5\u7684\u591a\u8868\u8bed\u6cd5\uff1a delete [low_priority] [quick] [ignore] from table_references [where where_condition] \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d table_references \u6307\u5b9a\u53c2\u4e0e\u5220\u9664\u64cd\u4f5c\u7684\u8868\uff0cwhere_condition \u6307\u5b9a\u5220\u9664\u6761\u4ef6\u3002 sql \u8bed\u53e5\u8303\u4f8b\uff1a DELETE FROM t1, t2 WHERE CONVERT(t1.username USING utf8mb4) = CONVERT(t2.username USING utf8mb4); \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528 UTF8MB4 \u6821\u5bf9\u96c6\u5220\u9664\u4e24\u4e2a\u8868\u4e2d\u5339\u914d\u7684\u5185\u5bb9\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\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-6973","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6973","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=6973"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6973\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}