MySQL 如何展示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)
以下查询用来仅展示“student”表的引擎:
mysql> show table status from sampletest Like '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)
阅读更多:MySQL 教程