我如何知道mysql表是否使用myISAM或InnoDB Engine? [英] How do I know if a mysql table is using myISAM or InnoDB Engine?

查看:229
本文介绍了我如何知道mysql表是否使用myISAM或InnoDB Engine?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MySQL中,无法为单个数据库指定存储引擎,只能为单个表指定存储引擎.但是,您可以使用以下命令指定要在一个会话中使用的存储引擎:

In MySQL, there is no way to specify a storage engine for a certain database, only for single tables. However, you can specify a storage engine to be used during one session with:

SET storage_engine=InnoDB;

因此您不必为每个表都指定它.

So you don't have to specify it for each table.

如何确认是否所有表确实都在使用InnoDB?

推荐答案

如果使用SHOW CREATE TABLE,则必须从查询中解析引擎.

If you use SHOW CREATE TABLE, you have to parse the engine out of the query.

从INFORMATION_SCHEMA数据库中进行选择是不明智的做法,因为开发人员保留随时更改其架构的权利(尽管可能性不大).

Selecting from the INFORMATION_SCHEMA database is poor practice, as the devs reserve the right to change its schema at any time (though it is unlikely).

要使用的正确查询是 SHOW表格状态 -您可以获取数据库中所有表的信息:

The correct query to use is SHOW TABLE STATUS - you can get information on all the tables in a database:

SHOW TABLE STATUS FROM `database`;

或针对特定表格:

SHOW TABLE STATUS FROM `database` LIKE 'tablename';

您将返回的一列是引擎.

One of the columns you will get back is Engine.

这篇关于我如何知道mysql表是否使用myISAM或InnoDB Engine?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆