{"id":200124,"date":"2025-05-06T09:04:03","date_gmt":"2025-05-06T01:04:03","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200124\/"},"modified":"2025-05-06T09:04:03","modified_gmt":"2025-05-06T01:04:03","slug":"%e4%bd%bf%e7%94%a8-mysql-%e9%80%9a%e9%85%8d%e7%ac%a6%ef%bc%9alike-%e5%92%8c-fulltext","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200124\/","title":{"rendered":"\u4f7f\u7528 MySQL \u901a\u914d\u7b26\uff1aLIKE \u548c FULLTEXT"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>\u4f7f\u7528 MySQL \u901a\u914d\u7b26\uff1aLIKE \u548c FULLTEXT<\/h1>\n<p>\u5728IT\u884c\u4e1a\u8fd9\u4e2a\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u5f88\u5feb\u7684\u884c\u4e1a\uff0c\u53ea\u6709\u4e0d\u505c\u6b62\u7684\u5b66\u4e60\uff0c\u624d\u4e0d\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u5982\u679c\u4f60\u662f\u6570\u636e\u5e93\u5b66\u4e60\u8005\uff0c\u90a3\u4e48\u672c\u6587\u300a\u4f7f\u7528 MySQL \u901a\u914d\u7b26\uff1aLIKE \u548c FULLTEXT\u300b\u5c31\u5f88\u9002\u5408\u4f60\uff01\u672c\u7bc7\u5185\u5bb9\u4e3b\u8981\u5305\u62ec##content_title##\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20240805\/172284700266b08f1ac46e5.jpg\" class=\"aligncenter\"><\/p>\n<p>mysql \u901a\u914d\u7b26\u63d0\u4f9b\u4e86\u6267\u884c\u7075\u6d3b\u641c\u7d22\u7684\u5f3a\u5927\u65b9\u6cd5\u3002\u672c\u6587\u6982\u8ff0\u4e86\u5728 mysql \u4e2d\u4f7f\u7528 like \u548c fulltext \u901a\u914d\u7b26\u7684\u57fa\u7840\u77e5\u8bc6\u3002<\/p>\n<h2> mysql \u901a\u914d\u7b26\u793a\u4f8b <\/h2>\n<p>\u559c\u6b22\u901a\u914d\u7b26<\/p>\n<pre>select * \nfrom [your_table] \nwhere [your_column] like 'string%';\n<\/pre>\n<p>% \u8868\u793a\u591a\u4e2a\u5b57\u7b26\u3002<\/p>\n<p>_ \u5bf9\u4e8e\u5355\u4e2a\u89d2\u8272\u3002<\/p>\n<p>\u5168\u6587\u901a\u914d\u7b26<\/p>\n<pre>SELECT * \nFROM [your_table] \nWHERE MATCH([column]) AGAINST('\"[string]*\"' IN BOOLEAN MODE);\n<\/pre>\n<p>* \u7528\u4e8e\u5e03\u5c14\u6a21\u5f0f\u8fdb\u884c\u5168\u6587\u641c\u7d22\u3002<\/p>\n<h2> \u5e38\u95ee\u95ee\u9898 <\/h2>\n<p><strong>mysql \u4e2d\u901a\u914d\u7b26\u641c\u7d22\u6709\u4ec0\u4e48\u7528\uff1f<\/strong><br \/> \u901a\u914d\u7b26\u641c\u7d22\u7528\u4e8e\u7075\u6d3b\u5339\u914d\uff0c\u975e\u5e38\u9002\u5408\u4e0d\u5b8c\u6574\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<p><strong>mysql \u4e2d\u6709\u54ea\u4e9b\u901a\u914d\u7b26\u641c\u7d22\u65b9\u6cd5\uff1f<\/strong><br \/> like \u548c fulltext \u662f\u4e3b\u8981\u7684\u901a\u914d\u7b26\u641c\u7d22\u65b9\u6cd5\u3002<\/p>\n<p><strong>\u4e3a\u4ec0\u4e48\u6211\u5e94\u8be5\u4f7f\u7528 sql \u5ba2\u6237\u7aef\uff1f<\/strong><br \/> \u50cf dbvisualizer \u8fd9\u6837\u7684 sql \u5ba2\u6237\u7aef\u53ef\u4ee5\u589e\u5f3a\u6570\u636e\u5e93\u6027\u80fd\u5e76\u652f\u6301\u5404\u79cd dbms\u3002<\/p>\n<h2> \u7ed3\u8bba <\/h2>\n<p>\u5b66\u4e60\u5728 mysql \u4e2d\u4f7f\u7528 like \u548c fulltext \u901a\u914d\u7b26\u53ef\u4ee5\u663e\u7740\u63d0\u9ad8\u4f60\u7684\u6570\u636e\u5e93\u67e5\u8be2\u80fd\u529b\u3002\u6709\u5173\u8be6\u7ec6\u6307\u5357\uff0c\u8bf7\u9605\u8bfb\u5168\u6587\uff1amysql \u4e2d\u7684\u901a\u914d\u7b26\uff1a\u5173\u4e8e like \u548c\u5168\u6587\u641c\u7d22\u901a\u914d\u7b26\u7684\u7efc\u5408\u6307\u5357\u3002<\/p>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300a\u4f7f\u7528 MySQL \u901a\u914d\u7b26\uff1aLIKE \u548c FULLTEXT\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01<\/p>\n<p> \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1adev.to \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb \u5220\u9664 <\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 MySQL \u901a\u914d\u7b26\uff1aLIK&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200124","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200124","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"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200124"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200124\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}