MySQL - 将表格引擎从 innoDB 更改为 MyISAM?


让我们先创建一个表 -

mysql> create table DemoTable1982
   (
   StudentId int
   ,
   StudentName varchar(20),
   StudentAge int
   );
Query OK, 0 rows affected (0.00 sec)

让我们检查一下表引擎类型 -

mysql> show create table DemoTable1982;

这会产生以下输出 -

+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table         | Create Table                                                                                                                                                                                                                         |
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| DemoTable1982 | CREATE TABLE `demotable1982` (`StudentId` int(11) DEFAULT NULL, `StudentName` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `StudentAge` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

以下是可以将表引擎从 innoDB 更改为 MyISAM 的查询 -

mysql> alter table DemoTable1982 ENGINE='MyISAM';
Query OK, 0 rows affected (0.00 sec)
Records: 0  Duplicates: 0  Warnings: 0

现在让我们检查一下表引擎的类型 -

mysql> show create table DemoTable1982;

这会产生以下输出 -

+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table         | Create Table                                                                                                                                                                                                                           |
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| DemoTable1982 | CREATE TABLE `demotable1982` ( `StudentId` int(11) DEFAULT NULL, `StudentName` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `StudentAge` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

更新于:2019 年 12 月 31 日

284 次浏览

开始你的职业生涯

在完成课程后,获得认证。

开始吧
广告
© . All rights reserved.