[Translated] How to check MySQL storage engine type on Linux

This commit is contained in:
zhengsihua 2014-07-08 10:01:28 +08:00
parent a1c1aec4e3
commit 7e4f49ca96
2 changed files with 41 additions and 43 deletions

View File

@ -1,43 +0,0 @@
Translating---------geekpi
How to check MySQL storage engine type on Linux
================================================================================
> **Question**: I need to know whether my MySQL database table is MyISAM or Innodb type. How can I check the type of a MySQL database table?
There are two major MySQL storage engines used: **MyISAM and Innodb**. MyISAM is non-transactional, and thus can be faster for reads, while InnoDB fully supports transactions (e.g., commit/rollback) with finer-grain locking. When you create a new MySQL table, you choose its type (i.e., storage engine). Without any choice, you will simply use a pre-configured default engine.
If you would like to know the type of an existing MySQL database table, there are a couple of ways to do it.
### Method One ###
If you have access to phpMyAdmin, you can find out the database type from phpMyAdmin. Simply choose your database from phpMyAdmin to see a list of its tables. Under "Type" column, you will see the database type for each table.
![](https://farm4.staticflickr.com/3871/14526575875_c1da3d9c7a_z.jpg)
### Method Two ###
If you can log in to a MySQL server directly, another way to identify the storage engine is to run the following MySQL command inside your MySQL server after logging in.
mysql> SELECT ENGINE FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'my_database' AND TABLE_NAME = 'my_table';
The above command will show the engine type of a table called 'my_table' in 'my_database' database.
### Method Three ###
Yet another method to check the MySQL engine is to use mysqlshow, a command-line utility which shows database information. The mysqlshow utility comes with [MySQL client package installation][1]. To use mysqlshow, you need to supply MySQL server login credential.
The following command will show information about a particular database. Under "Engine" column, you will see the storage engine for each table.
$ mysqlshow -u <mysql_user> -p -i <database-name>
![](https://farm4.staticflickr.com/3845/14340200549_8fbe7ea7b5_z.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/check-mysql-storage-engine-type-linux.html
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://xmodulo.com/2013/06/how-to-install-mysql-server-and-client-on-linux.html

View File

@ -0,0 +1,41 @@
如何在Linux上检查MySQL的存储引擎类型
================================================================================
> **提问**: 我想要知道我的MySQL数据库是MyISAM还是Innodb类型。我该如何检查MySQL数据库表的类型
MySQl主要使用两种存储引擎**MyISAM and Innodb**。MyISAM是非事务的因此拥有读取更快然而InnoDB完全支持细颗粒的事务锁定比如commit/rollback。当你创建一张新的MySQL表时你要选择它的类型也就是存储引擎。如果没有选择你就会使用与预设置的默认引擎。
如果你想要知道已经存在的MySQL数据表的类型这里有几种方法达到。
### 方法一 ###
如果你可以访问phpMyAdmin你可以从phpMyAdmin找出默认的数据库类型。从phpMyAdmin中选中数据库来查看它的表列表。在“Type”一列的下面你会看到每个表的数据表类型。
![](https://farm4.staticflickr.com/3871/14526575875_c1da3d9c7a_z.jpg)
### 方法二 ###
如果你可以直接登录MySQL服务器另外一种鉴别存储引擎的方法是登录MySQL服务器后运行下面的MySQL命令
mysql> SELECT ENGINE FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'my_database' AND TABLE_NAME = 'my_table';
上面的命令会显示在'my_database'数据库中'my_table'表的引擎类型。
### 方法三 ###
还有一种检查引擎的方法是使用mysqlshow,是一种命令行下的显示数据库信息的工具。mysqlshow在[MySQL 客户端安装包][1]中有。要使用mysqlshow你需要提供MySQL服务器登录凭据。
下面的命令会显示特定的数据库信息。在“Engine”一列下面你可以看到每个表使用的引擎。
$ mysqlshow -u <mysql_user> -p -i <database-name>
![](https://farm4.staticflickr.com/3845/14340200549_8fbe7ea7b5_z.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/check-mysql-storage-engine-type-linux.html
译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://xmodulo.com/2013/06/how-to-install-mysql-server-and-client-on-linux.html