如何查看mysql表的存储引擎

时间:2019-08-20 17:58:18  来源:igfitidea点击:

在mysql服务器上工作时,有时需要了解数据库中表的存储引擎是什么。
我们主要使用Innodb和MyISAM,但可能在mysql服务器中也可以使用其他存储引擎。

在mysql中要查看mysql表的存储引擎,可以使用下面的命令

登录mysql server

mysql -u root -p

连接数据库

use database-name

在mysql提示符下执行下面的命令。查看第二个字段“引擎”

show table status where `Name` = 'table-name' G;

示例:

Hyman@theitroad:~/Desktop/data3/data2$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 190
Server version: 5.5.29-0ubuntu0.12.10.1 (Ubuntu)

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> use linux
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show table status where `Name` = 'tutorials_tbl' G;
*************************** 1. row ***************************
           Name: tutorials_tbl
         Engine: InnoDB
        Version: 10
     Row_format: Compact
           Rows: 1
 Avg_row_length: 16384
    Data_length: 16384
Max_data_length: 0
   Index_length: 0
      Data_free: 7340032
 Auto_increment: 2
    Create_time: 2013-08-10 16:16:13
    Update_time: NULL
     Check_time: NULL
      Collation: latin1_swedish_ci
       Checksum: NULL
 Create_options: 
        Comment: 
1 row in set (0.00 sec)

ERROR: 
No query specified

mysql>