如何顯示 MySQL 表的引擎?


瞭解 MySQL 表是否使用 MyISAM 或 InnoDB 引擎,可以使用以下語法。

以下語法可用於多張表 −

show table status from yourDatabaseName;

這是一個可以用於特定表(即瞭解表引擎)的語法 −

show table status from yourDatabaseName Like ‘yourTableName’.

以下是要顯示所有表引擎的查詢 −

mysql> show table status from sampleTest;

這是輸出 −

+--------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+----------------+---------+
| 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 | Collation | Checksum | Create_options | Comment   |
+--------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+----------------+---------+
| datetimedemo | InnoDB | 10      | Dynamic    | 0    | 0              | 16384       | 0               | 0             | 0         | NULL          | 2018-12-05 09:22:54 | NULL                | NULL  | utf8mb4_0900_ai_ci      | NULL      |               |         |
| primarydemo  | InnoDB | 10      | Dynamic    | 0    | 0              | 16384        | 0              | 0             | 0          | NULL         | 2018-12-05 09:23:34 | NULL                | NULL   | utf8mb4_0900_ai_ci | NULL |                         |         |
| student      | MyISAM | 10      | Dynamic    | 0    | 0         |    | 281474976710655 | 1024 | 0 | 1 | 2018-12-05 09:22:22 | 2018-12-05 09:22:23 | NULL | utf8mb4_0900_ai_ci | NULL | | |
+--------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+----------------+---------+
3 rows in set (0.19 sec)

以下是要顯示特定表的引擎型別的查詢 −

mysql> show table status from sampletest Like 'student';

這是顯示僅“student”表的引擎的輸出 −

+---------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+----------------+---------+
| 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 | Collation          | Checksum | Create_options | Comment |
+---------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+----------------+---------+
| student | MyISAM | 10      | Dynamic    | 0    | 0              | 0 | 281474976710655 | 1024 | 0 | 1 | 2018-12-05 09:22:22 | 2018-12-05 09:22:23 | NULL | utf8mb4_0900_ai_ci | NULL | | |
+---------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+----------------+---------+
1 row in set (0.00 sec)

更新於: 25-6-2020

1K+ 瀏覽量

開啟你的 事業

完成課程獲得認證

開始
廣告
© . All rights reserved.