如何查看mysql数据库表所使用的引擎(转载)

我们怎么样才能准确的查看mysql的存储引擎呢,下面我给大家介绍两种正确的方式。

1)正确方式一: SHOW TABLE STATUS from 数据库库名 where Name='表名'

2)mysqlshow -u 数据库登录帐号 -p


有时的时候,我们想查看以下mysql的表的存储引擎是什么类型的,不用说,大家直接想到的就是使用show create table命令查看创建表的命令,从而直接认为定义表的引擎就是表的真正存储引擎,这个方法在大多数情况下是没有错的,但是在有的时候却是致命的错误,因为有的时候明明看的的是 engine =myisam ,怎么会select count(*) from tbl_name 的查询速度怎么会真么慢呢。这种情况一般会出现在使用该创建表的存储没有安装成功,从而导致表使用的时数据库的默认存储引擎。因此严格的来说查看mysql的表的存储引擎使用show create table命令是不完全正确的。正确的方式是使用下面我介绍的两种方式,这两种方式查看出来的是没有任何问题的,还请大家仔细阅读下面的文章

正确方式一:  SHOW TABLE STATUS from  数据库库名  where Name='表名';

01.hymin@Ubuntu:/myhome$ mysql -uroot -p'mypassword' 02.Welcome to the MySQL monitor.  Commands end with ; or g. 03.Your MySQL connection id is 221 04.Server version: 5.1.41-3ubuntu12.7 (Ubuntu) 05. 06.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. 07. 08.mysql> SHOW TABLE STATUS from mytest where Name='test'; 09.+------------+--------+---------+------------+------+----------------+-------------+(省略部分结果) 10.| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length |(省略部分结果) 11.+------------+--------+---------+------------+------+----------------+-------------+(省略部分结果) 12.| test | MyISAM |      10 | Fixed      |    0 |              0 |           0 |(省略部分结果) 13.+------------+--------+---------+------------+------+----------------+-------------+(省略部分结果) 14.1 row in set (0.02 sec) 15. 16.mysql>

5. 正确方式二: mysqlshow  -u 数据库登录帐号 -p '数据库登录帐号密码'   --status   数据库库名   表名

1.hymin@Ubuntu:/myhome$ mysqlshow  -uroot -p'mypassword'   --status mytest test 2.Database:mytest  Wildcard: test 3.+------------+--------+---------+------------+------+----------------+-------------+(省略部分结果) 4.| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length |(省略部分结果) 5.+------------+--------+---------+------------+------+----------------+-------------+(省略部分结果) 6.| test | MyISAM |      10 | Fixed      |    0 |              0 |           0 |(省略部分结果) 7.+------------+--------+---------+------------+------+----------------+-------------+(省略部分结果)

转载自:http://www.cnblogs.com/clouds008/archive/2013/06/10/3130680.html

原文地址:https://www.cnblogs.com/wangqiideal/p/4554125.html