{"id":6590,"date":"2024-11-14T13:11:11","date_gmt":"2024-11-14T05:11:11","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6590\/"},"modified":"2024-11-14T13:11:11","modified_gmt":"2024-11-14T05:11:11","slug":"mysql%e5%88%a4%e6%96%ad%e8%a1%a8%e6%98%af%e5%90%a6%e5%ad%98%e5%9c%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6590\/","title":{"rendered":"mysql\u5224\u65ad\u8868\u662f\u5426\u5b58\u5728"},"content":{"rendered":"<blockquote><p>\n  mysql \u8868\u662f\u5426\u5b58\u5728\u5224\u65ad\u65b9\u6cd5\uff1a1. \u67e5\u8be2\u4fe1\u606f\u67b6\u6784\u8868\uff1b2. \u4f7f\u7528 desc \u547d\u4ee4\uff1b3. \u4f7f\u7528 show tables \u547d\u4ee4\uff1b4. \u4f7f\u7528 check table \u547d\u4ee4\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/06\/2024080618395785844.jpg\" class=\"aligncenter\" title=\"mysql\u5224\u65ad\u8868\u662f\u5426\u5b58\u5728\u63d2\u56fe\" alt=\"mysql\u5224\u65ad\u8868\u662f\u5426\u5b58\u5728\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5224\u65ad MySQL \u8868\u662f\u5426\u5b58\u5728\uff1f<\/strong><\/p>\n<p>\u5728 MySQL \u4e2d\uff0c\u5224\u65ad\u8868\u662f\u5426\u5b58\u5728\u6709\u591a\u79cd\u65b9\u6cd5\uff1a<\/p>\n<p><strong>1. \u76f4\u63a5\u67e5\u8be2\u4fe1\u606f\u67b6\u6784\u8868<\/strong><\/p>\n<pre>SELECT table_name\nFROM information_schema.tables\nWHERE table_schema = 'database_name'\nAND table_name = 'table_name';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u4e0d\u4e3a\u7a7a\uff0c\u5219\u8be5\u8868\u5b58\u5728\u3002<\/p>\n<p><strong>2. \u4f7f\u7528 DESC \u547d\u4ee4<\/strong><\/p>\n<p>DESC \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u8868\u7684\u7ed3\u6784\u4fe1\u606f\u3002\u5982\u679c\u8868\u5b58\u5728\uff0c\u5219\u547d\u4ee4\u5c06\u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6\u3002<\/p>\n<pre>DESC table_name;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u4f7f\u7528 SHOW TABLES \u547d\u4ee4<\/strong><\/p>\n<p>SHOW TABLES \u547d\u4ee4\u663e\u793a\u6570\u636e\u5e93\u4e2d\u6240\u6709\u8868\u7684\u5217\u8868\u3002\u5982\u679c\u8868\u5b58\u5728\uff0c\u5219\u5b83\u5c06\u5728\u5217\u8868\u4e2d\u51fa\u73b0\u3002<\/p>\n<pre>SHOW TABLES LIKE 'table_name';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u4f7f\u7528 CHECK TABLE \u547d\u4ee4<\/strong><\/p>\n<p>CHECK TABLE \u547d\u4ee4\u5bf9\u6307\u5b9a\u7684\u8868\u8fdb\u884c\u5b8c\u6574\u6027\u68c0\u67e5\u3002\u5982\u679c\u8868\u5b58\u5728\uff0c\u5219\u547d\u4ee4\u5c06\u8fd4\u56de\u4e00\u4e2a\u72b6\u6001\u4fe1\u606f\uff0c\u5176\u4e2d\u4f1a\u5305\u542b\u8868\u662f\u5426\u5b58\u5728\u7684\u4fe1\u606f\u3002<\/p>\n<pre>CHECK TABLE table_name;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5224\u65ad\u8868\u662f\u5426\u5b58\u5728\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>mysql \u8868\u662f\u5426\u5b58\u5728\u5224\u65ad\u65b9\u6cd5\uff1a1. \u67e5\u8be2\u4fe1\u606f\u67b6\u6784\u8868\uff1b2. \u4f7f\u7528 desc \u547d\u4ee4\uff1b3. \u4f7f\u7528 show tables \u547d\u4ee4\uff1b4. \u4f7f\u7528 check table \u547d\u4ee4\u3002 \u5982\u4f55\u5224\u65ad MySQL \u8868\u662f\u5426\u5b58\u5728\uff1f \u5728 MySQL \u4e2d\uff0c\u5224\u65ad\u8868\u662f\u5426\u5b58\u5728\u6709\u591a\u79cd\u65b9\u6cd5\uff1a 1. \u76f4\u63a5\u67e5\u8be2\u4fe1\u606f\u67b6\u6784\u8868 SELECT table_name FROM information_schema.tables WHERE table_schema = &#8216;database_name&#8217; AND table_name = &#8216;table_name&#8217;; \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u67e5\u8be2\u7ed3\u679c\u4e0d\u4e3a\u7a7a\uff0c\u5219\u8be5\u8868\u5b58\u5728\u3002 2. \u4f7f\u7528 DESC \u547d\u4ee4 DESC \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u8868\u7684\u7ed3\u6784\u4fe1\u606f\u3002\u5982\u679c\u8868\u5b58\u5728\uff0c\u5219\u547d\u4ee4\u5c06\u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6\u3002 DESC table_name; \u767b\u5f55\u540e\u590d\u5236 3. \u4f7f\u7528 SHOW TABLES \u547d\u4ee4 SHOW TABLES \u547d\u4ee4\u663e\u793a\u6570\u636e\u5e93\u4e2d\u6240\u6709\u8868\u7684\u5217\u8868\u3002\u5982\u679c\u8868\u5b58\u5728\uff0c\u5219\u5b83\u5c06\u5728\u5217\u8868\u4e2d\u51fa\u73b0\u3002 SHOW TABLES [&hellip;]<\/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-6590","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6590","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=6590"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6590\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}