{"id":1394,"date":"2024-05-08T10:07:57","date_gmt":"2024-05-08T02:07:57","guid":{"rendered":"http:\/\/oneai.eu.org\/?p=1394"},"modified":"2024-05-08T10:07:57","modified_gmt":"2024-05-08T02:07:57","slug":"mysql-%e5%b8%b8%e7%94%a8%e6%9f%a5%e8%af%a2%e8%af%ad%e5%8f%a5","status":"publish","type":"post","link":"https:\/\/oneai.eu.org\/?p=1394","title":{"rendered":"mysql \u5e38\u7528\u67e5\u8be2\u8bed\u53e5"},"content":{"rendered":"<h2>1.show table status from dbname\\G;  \/\/\u67e5\u8be2\u6570\u636e\u5e93\u7684\u788e\u7247<br \/>\nuse test;<br \/>\nmysql&gt; show table status from test\\G;<br \/>\n<strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><em> 1. row <\/em><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><br \/>\nName: test<br \/>\nEngine: InnoDB<br \/>\nVersion: 10<br \/>\nRow_format: Compact<br \/>\nRows: 45<br \/>\nAvg_row_length: 364<br \/>\nData_length: 16384<br \/>\nMax_data_length: 0<br \/>\nIndex_length: 16384<br \/>\nData_free: 0<br \/>\nAuto_increment: NULL<br \/>\nCreate_time: 2015-01-14 11:25:23<br \/>\nUpdate_time: NULL<br \/>\nCheck_time: NULL<br \/>\nCollation: latin1_swedish_ci<br \/>\nChecksum: NULL<br \/>\nCreate_options:<br \/>\nComment:<br \/>\n1 row in set (0.00 sec)<br \/>\nData_free\uff1a\u4e0d\u7b490\u8868\u793a\u6709\u788e\u7247<\/h2>\n<p>\u67e5\u8be2\u6240\u6709\u5e93\uff08\u9664mysql\u5e93\uff09\u7684\u6240\u6709\u788e\u7247\u4fe1\u606f<br \/>\nselect table_schema, table_name, data_free, engine from information_schema.tables where table_schema not in ('information_schema', 'mysql') and data_free &gt; 0; <\/p>\n<p>2.show create table from tablename \/\/\u67e5\u770b\u5efa\u8868\u8bed\u53e5<br \/>\n3.show create function from functionname  \/\/\u67e5\u770b\u521b\u5efa\u51fd\u6570\u8bed\u53e5<br \/>\n4 show indexes from tablename         \/\/\u67e5\u770b\u8868\u7684\u7d22\u5f15<br \/>\n5 show variable like 'varname'      \/\/\u67e5\u770b\u914d\u7f6e\u53d8\u91cf\u7684\u503c<br \/>\n6 show [full ] processlist           \/\/\u67e5\u770bSQL\u8fdb\u7a0b\u5217\u8868<br \/>\n7  show [engine innodb] status \\G;                     \/\/\u67e5\u770b[innodb]\u5404\u79cd\u72b6\u6001<\/p>\n<ol start=\"8\">\n<li>show databases \/show tables \/desc tablename <\/li>\n<li>\n<p>show plugins                 \/\/\u663e\u793a\u6240\u6709\u63d2\u4ef6<br \/>\n10\u3002show table status from [dbname] where name='tablename'; \/\/\u67e5\u770b\u67d0\u5e93\u67d0\u4e2a\u8868\u7684\u72b6\u6001\u4fe1\u606f<br \/>\nshow slave\/master status;            \/\/\u67e5\u770b\u4e3b\u4ece\u5e93\u7684\u72b6\u6001<br \/>\nSHOW MASTER LOGS                       \/\/\u67e5\u770bbinlog \u65e5\u5fd7<br \/>\nSHOW BINARY LOGS                        \/\/\u67e5\u770bbinlog\u65e5\u5fd7<br \/>\nSHOW SLAVE HOSTS                        \/\/\u67e5\u770b\u4ece\u670d\u52a1\u5668\u4fe1\u606f<br \/>\nshow binlog events\\G                   \/\/\u67e5\u770bbinlog\u4e8b\u4ef6\u3002<\/p>\n<p>CREATE DATABASE <code>cptest<\/code> DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;<\/p>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>1.show table status from dbname\\G; \/\/\u67e5\u8be2\u6570\u636e\u5e93\u7684\u788e\u7247 use test; mysql&gt; show table status from test\\G; 1. row Name: test Engine: InnoDB Version: 10 Row_format: Compact Rows: 45 Avg_row_length: 364 Data_length: 16384 Max_data_length: 0 Index_length: 16384 Data_free: 0 Auto_increment: NULL Create_time: 2015-01-14 11:25:23 Update_time: NULL Check_time: NULL Collation: latin1_swedish_ci Checksum: NULL Create_options: Comment: 1 row in set (0.00 sec) Data_free\uff1a\u4e0d\u7b490\u8868\u793a\u6709\u788e\u7247 \u67e5\u8be2\u6240\u6709\u5e93\uff08\u9664mysql\u5e93\uff09\u7684\u6240\u6709\u788e\u7247\u4fe1\u606f select table_schema, table_name, data_free, engine from information_schema.tables where table_schema not in (&#8216;information_schema&#8217;, &#8216;mysql&#8217;) and data_free &gt; 0; 2.show create table from tablename \/\/\u67e5\u770b\u5efa\u8868\u8bed\u53e5 3.show create function from functionname \/\/\u67e5\u770b\u521b\u5efa\u51fd\u6570\u8bed\u53e5 4 show indexes from tablename \/\/\u67e5\u770b\u8868\u7684\u7d22\u5f15 5 show variable like &#8216;varname&#8217; \/\/\u67e5\u770b\u914d\u7f6e\u53d8\u91cf\u7684\u503c 6 show [full ] processlist \/\/\u67e5\u770bSQL\u8fdb\u7a0b\u5217\u8868 7 show [engine innodb] status \\G; \/\/\u67e5\u770b[innodb]\u5404\u79cd\u72b6\u6001 show databases \/show tables \/desc tablename show plugins \/\/\u663e\u793a\u6240\u6709\u63d2\u4ef6 10\u3002show table status from [dbname] where name=&#8217;tablename&#8217;; \/\/\u67e5\u770b\u67d0\u5e93\u67d0\u4e2a\u8868\u7684\u72b6\u6001\u4fe1\u606f show slave\/master status; \/\/\u67e5\u770b\u4e3b\u4ece\u5e93\u7684\u72b6\u6001 SHOW MASTER LOGS \/\/\u67e5\u770bbinlog \u65e5\u5fd7 SHOW BINARY LOGS \/\/\u67e5\u770bbinlog\u65e5\u5fd7 SHOW SLAVE HOSTS \/\/\u67e5\u770b\u4ece\u670d\u52a1\u5668\u4fe1\u606f show binlog events\\G \/\/\u67e5\u770bbinlog\u4e8b\u4ef6\u3002 CREATE DATABASE cptest DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","footnotes":""},"categories":[83],"tags":[],"class_list":["post-1394","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/1394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1394"}],"version-history":[{"count":1,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/1394\/revisions"}],"predecessor-version":[{"id":1395,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/1394\/revisions\/1395"}],"wp:attachment":[{"href":"https:\/\/oneai.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}