{"id":172681,"date":"2024-11-07T15:09:22","date_gmt":"2024-11-07T07:09:22","guid":{"rendered":"https:\/\/server.hk\/cnblog\/172681\/"},"modified":"2024-11-07T15:09:22","modified_gmt":"2024-11-07T07:09:22","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e8%a9%a2%e8%a1%a8%e7%9a%84%e5%bc%95%e6%93%8e%e9%a1%9e%e5%9e%8b-%e5%a6%82%e4%bd%95%e6%9f%a5%e8%a9%a2%e6%95%b8%e6%93%9a%e5%ba%ab%e8%a1%a8%e7%9a%84%e5%bc%95%e6%93%8e","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/172681\/","title":{"rendered":"\u5982\u4f55\u67e5\u8a62\u8868\u7684\u5f15\u64ce\u985e\u578b (\u5982\u4f55\u67e5\u8a62\u6578\u64da\u5eab\u8868\u7684\u5f15\u64ce)"},"content":{"rendered":"<h1 id=\"%e5%a6%82%e4%bd%95%e6%9f%a5%e8%a9%a2%e8%a1%a8%e7%9a%84%e5%bc%95%e6%93%8e%e9%a1%9e%e5%9e%8b-%e5%a6%82%e4%bd%95%e6%9f%a5%e8%a9%a2%e6%95%b8%e6%93%9a%e5%ba%ab%e8%a1%a8%e7%9a%84%e5%bc%95%e6%93%8e-YXiYnQrmxg\">\u5982\u4f55\u67e5\u8a62\u8868\u7684\u5f15\u64ce\u985e\u578b (\u5982\u4f55\u67e5\u8a62\u6578\u64da\u5eab\u8868\u7684\u5f15\u64ce)<\/h1>\n<p>\u5728\u4f7f\u7528\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff08DBMS\uff09\u6642\uff0c\u4e86\u89e3\u8868\u7684\u5f15\u64ce\u985e\u578b\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u4e0d\u540c\u7684\u5f15\u64ce\u63d0\u4f9b\u4e0d\u540c\u7684\u529f\u80fd\u548c\u6027\u80fd\u7279\u5fb5\uff0c\u9019\u53ef\u80fd\u6703\u5f71\u97ff\u5230\u61c9\u7528\u7a0b\u5e8f\u7684\u6548\u7387\u548c\u7a69\u5b9a\u6027\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u67e5\u8a62\u6578\u64da\u5eab\u8868\u7684\u5f15\u64ce\u985e\u578b\uff0c\u7279\u5225\u662f\u91dd\u5c0d MySQL \u6578\u64da\u5eab\u7684\u64cd\u4f5c\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e6%95%b8%e6%93%9a%e5%ba%ab%e5%bc%95%e6%93%8e%ef%bc%9f-YXiYnQrmxg\">\u4ec0\u9ebc\u662f\u6578\u64da\u5eab\u5f15\u64ce\uff1f<\/h2>\n<p>\u6578\u64da\u5eab\u5f15\u64ce\u662f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\u7684\u4e00\u90e8\u5206\uff0c\u8ca0\u8cac\u6578\u64da\u7684\u5b58\u5132\u3001\u6aa2\u7d22\u548c\u7ba1\u7406\u3002\u4e0d\u540c\u7684\u5f15\u64ce\u6709\u4e0d\u540c\u7684\u7279\u6027\uff0c\u4f8b\u5982\u4e8b\u52d9\u652f\u6301\u3001\u9396\u5b9a\u6a5f\u5236\u548c\u6027\u80fd\u512a\u5316\u3002MySQL \u662f\u4e00\u500b\u6d41\u884c\u7684\u958b\u6e90\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u652f\u6301\u591a\u7a2e\u5f15\u64ce\uff0c\u5982 InnoDB\u3001MyISAM \u548c MEMORY \u7b49\u3002<\/p>\n<h2 id=\"%e6%9f%a5%e8%a9%a2%e8%a1%a8%e7%9a%84%e5%bc%95%e6%93%8e%e9%a1%9e%e5%9e%8b-YXiYnQrmxg\">\u67e5\u8a62\u8868\u7684\u5f15\u64ce\u985e\u578b<\/h2>\n<p>\u8981\u67e5\u8a62 MySQL \u6578\u64da\u5eab\u4e2d\u67d0\u500b\u8868\u7684\u5f15\u64ce\u985e\u578b\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b SQL \u8a9e\u53e5\uff1a<\/p>\n<pre><code>SHOW TABLE STATUS LIKE 'your_table_name';<\/code><\/pre>\n<p>\u5728\u9019\u500b\u8a9e\u53e5\u4e2d\uff0c\u5c07 &#8216;your_table_name&#8217; \u66ff\u63db\u70ba\u4f60\u60f3\u67e5\u8a62\u7684\u8868\u540d\u3002\u57f7\u884c\u9019\u500b\u8a9e\u53e5\u5f8c\uff0c\u6703\u8fd4\u56de\u4e00\u500b\u5305\u542b\u591a\u500b\u6b04\u4f4d\u7684\u7d50\u679c\u96c6\uff0c\u5176\u4e2d\u6709\u4e00\u500b\u540d\u70ba <strong>Engine<\/strong> \u7684\u6b04\u4f4d\uff0c\u986f\u793a\u8a72\u8868\u7684\u5f15\u64ce\u985e\u578b\u3002<\/p>\n<h3 id=\"%e7%a4%ba%e4%be%8b-YXiYnQrmxg\">\u793a\u4f8b<\/h3>\n<p>\u5047\u8a2d\u6211\u5011\u6709\u4e00\u500b\u540d\u70ba <strong>users<\/strong> \u7684\u8868\uff0c\u6211\u5011\u53ef\u4ee5\u9019\u6a23\u67e5\u8a62\u5b83\u7684\u5f15\u64ce\u985e\u578b\uff1a<\/p>\n<pre><code>SHOW TABLE STATUS LIKE 'users';<\/code><\/pre>\n<p>\u57f7\u884c\u5f8c\u7684\u7d50\u679c\u53ef\u80fd\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre><code>+-------+--------+---------+------------+-------+----------------+-------------+----------------+----------------+----------------+----------------+----------------+----------------+\n| Name  | Engine | Version | Row_format | Rows  | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time |\n+-------+--------+---------+------------+-------+----------------+-------------+----------------+----------------+----------------+----------------+----------------+----------------+\n| users | InnoDB |      10 | Dynamic    |  1000 |             50 |       50000 |               0 |         16384 |          0 |           1 | 2023-01-01 | NULL | NULL |\n+-------+--------+---------+------------+-------+----------------+-------------+----------------+----------------+----------------+----------------+----------------+----------------+<\/code><\/pre>\n<p>\u5728\u9019\u500b\u7d50\u679c\u4e2d\uff0c<strong>Engine<\/strong> \u6b04\u4f4d\u986f\u793a\u8a72\u8868\u4f7f\u7528\u7684\u662f <strong>InnoDB<\/strong> \u5f15\u64ce\u3002<\/p>\n<h2 id=\"%e4%bd%bf%e7%94%a8-information_schema-%e6%9f%a5%e8%a9%a2%e5%bc%95%e6%93%8e%e9%a1%9e%e5%9e%8b-YXiYnQrmxg\">\u4f7f\u7528 INFORMATION_SCHEMA \u67e5\u8a62\u5f15\u64ce\u985e\u578b<\/h2>\n<p>\u9664\u4e86\u4f7f\u7528 <code>SHOW TABLE STATUS<\/code>\uff0c\u9084\u53ef\u4ee5\u901a\u904e\u67e5\u8a62 <strong>INFORMATION_SCHEMA<\/strong> \u6578\u64da\u5eab\u4f86\u7372\u53d6\u8868\u7684\u5f15\u64ce\u985e\u578b\u3002\u4ee5\u4e0b\u662f\u76f8\u61c9\u7684 SQL \u8a9e\u53e5\uff1a<\/p>\n<pre><code>SELECT TABLE_NAME, ENGINE FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'your_database_name' AND TABLE_NAME = 'your_table_name';<\/code><\/pre>\n<p>\u5728\u9019\u88e1\uff0c\u5c07 <strong>your_database_name<\/strong> \u66ff\u63db\u70ba\u4f60\u7684\u6578\u64da\u5eab\u540d\u7a31\uff0c<strong>your_table_name<\/strong> \u66ff\u63db\u70ba\u4f60\u8981\u67e5\u8a62\u7684\u8868\u540d\u3002\u9019\u500b\u67e5\u8a62\u5c07\u8fd4\u56de\u8a72\u8868\u7684\u540d\u7a31\u548c\u5f15\u64ce\u985e\u578b\u3002<\/p>\n<h3 id=\"%e7%a4%ba%e4%be%8b-YXiYnQrmxg\">\u793a\u4f8b<\/h3>\n<p>\u5982\u679c\u6211\u5011\u8981\u67e5\u8a62 <strong>users<\/strong> \u8868\u7684\u5f15\u64ce\u985e\u578b\uff0c\u4e26\u4e14\u5b83\u4f4d\u65bc\u540d\u70ba <strong>my_database<\/strong> \u7684\u6578\u64da\u5eab\u4e2d\uff0c\u53ef\u4ee5\u9019\u6a23\u57f7\u884c\uff1a<\/p>\n<pre><code>SELECT TABLE_NAME, ENGINE FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'my_database' AND TABLE_NAME = 'users';<\/code><\/pre>\n<p>\u9019\u5c07\u8fd4\u56de\u985e\u4f3c\u4ee5\u4e0b\u7684\u7d50\u679c\uff1a<\/p>\n<pre><code>+------------+--------+\n| TABLE_NAME | ENGINE |\n+------------+--------+\n| users      | InnoDB |\n+------------+--------+<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-YXiYnQrmxg\">\u7e3d\u7d50<\/h2>\n<p>\u67e5\u8a62\u6578\u64da\u5eab\u8868\u7684\u5f15\u64ce\u985e\u578b\u662f\u7ba1\u7406\u6578\u64da\u5eab\u7684\u91cd\u8981\u6b65\u9a5f\uff0c\u80fd\u5e6b\u52a9\u958b\u767c\u8005\u548c\u7ba1\u7406\u54e1\u4e86\u89e3\u8868\u7684\u6027\u80fd\u7279\u5fb5\u548c\u529f\u80fd\u9650\u5236\u3002\u7121\u8ad6\u662f\u4f7f\u7528 <code>SHOW TABLE STATUS<\/code> \u9084\u662f\u67e5\u8a62 <strong>INFORMATION_SCHEMA<\/strong>\uff0c\u90fd\u80fd\u8f15\u9b06\u7372\u5f97\u6240\u9700\u7684\u4fe1\u606f\u3002\u5c0d\u65bc\u9700\u8981\u9ad8\u6027\u80fd\u548c\u7a69\u5b9a\u6027\u7684\u61c9\u7528\uff0c\u9078\u64c7\u5408\u9069\u7684\u6578\u64da\u5eab\u5f15\u64ce\u81f3\u95dc\u91cd\u8981\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u7684\u5ba2\u6236\u3002\u7121\u8ad6\u662f\u4f01\u696d\u7d1a\u61c9\u7528\u9084\u662f\u500b\u4eba\u9805\u76ee\uff0c\u6211\u5011\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u90fd\u80fd\u70ba\u60a8\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3\u5982\u4f55\u67e5\u8a62\u6578\u64da\u5eab\u8868\u7684\u5f15\u64ce\u985e\u578b\uff0c\u638c\u63e1\u4f7f\u7528 SQL \u6307\u4ee4\u8f15\u9b06\u7372\u53d6\u8868\u7684\u5f15\u64ce\u4fe1\u606f\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-172681","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/172681","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=172681"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/172681\/revisions"}],"predecessor-version":[{"id":172682,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/172681\/revisions\/172682"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=172681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=172681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=172681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}