MySQL 如何知道一个表是使用MyISAM还是InnoDB引擎
要知道MySQL表是否使用MyISAM或InnoDB引擎,可以使用命令show status table。语法如下:
SHOW TABLE STATUS from yourDatabaseName LIKE ‘yourTableName’.
上述语法有关于特定的表引擎。您现在可以应用上述语法来知道MySQL表引擎是否使用MyISAM或InnoDB。
这里,我有数据库‘business’和表‘student’。查询如下:
mysql> show table status from business 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 | InnoDB | 10 | Dynamic | 2 | 8192 | 16384 | 0 | 32768 | 0 | NULL | 2018-10-01 12:26:57 | NULL | NULL | utf8mb4_unicode_ci | NULL | | |
+---------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+----------------+---------+
1 row in set (0.09 sec)
要知道所有表的引擎类型,可以使用以下语法:
SHOW TABLE STATUS FROM yourDatabaseName;
将上述语法应用于以下查询中:
mysql> show table status from business;
以下是显示所有引擎的输出:
阅读更多:MySQL 教程