可能重复:
How can I check MySQL engine type for a specific table?
假设用户是一个跟随命令的表,则不会显示用户表是MyISAM还是Innodb。
desc users;
如何找到用户表的类型?
答案 0 :(得分:42)
您可以使用SHOW TABLE STATUS
查看表信息。
SHOW TABLE STATUS WHERE `Name` = 'my_table';
只需检查返回数据集中Engine
列的值,即可知道该表正在使用哪个引擎。
答案 1 :(得分:17)
SELECT ENGINE
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='your_table_name'
AND TABLE_SCHEMA='your_database_name';
-- or use TABLE_SCHEMA=DATABASE() if you have a default one.
答案 2 :(得分:5)
您可以使用SHOW CREATE TABLE
并在回复中查找ENGINE
部分。
SHOW CREATE TABLE users;
示例:
CREATE TABLE innodb_table (id int, value int) ENGINE=INNODB;
CREATE TABLE myisam_table (id int, value int) ENGINE=MYISAM;
CREATE TABLE default_table (id int, value int);
innodb_table
的结果:
SHOW CREATE TABLE innodb_table;
+--------------+----------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+--------------+----------------------------------------------------------------------------------------------------------------------------------+
| innodb_table | CREATE TABLE `innodb_table` (
`id` int(11) DEFAULT NULL,
`value` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+--------------+----------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
myisam_table
的结果:
SHOW CREATE TABLE myisam_table;
+--------------+----------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+--------------+----------------------------------------------------------------------------------------------------------------------------------+
| myisam_table | CREATE TABLE `myisam_table` (
`id` int(11) DEFAULT NULL,
`value` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+--------------+----------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
default_table
的结果:
SHOW CREATE TABLE default_table;
+---------------+-----------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+---------------+-----------------------------------------------------------------------------------------------------------------------------------+
| default_table | CREATE TABLE `default_table` (
`id` int(11) DEFAULT NULL,
`value` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+---------------+-----------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)