English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

MySQL에서 MyISAM을 InnoDB 스토리지 엔진으로 변환하는 방법은 무엇인가요?

要将MyISAM引擎转换为InnoDB,我们可以使用ALTER命令。现在让我们在引擎MyISAM的帮助下创建一个表。

mysql> create table MyISAMToInnoDBDemo
   -> (
   -> id int,
   -> Name varchar(100)
   -> ENGINE=MyISAM;

检查表是否使用引擎MyISAM创建。

mysql> SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'business' and ENGINE = 'MyISAM';

以下是显示使用MyISAM引擎创建的表的输出。

+-------------------------+--------+
| TABLE_NAME                    | ENGINE |
+-------------------------+--------+
| studentrecordwithmyisam | MyISAM |
+-------------------------+--------+
1 row in set (0.00 sec)

我们可以借助ALTER命令将MyISAM转换为InnoDB。

mysql> alter table MyISAMToInnoDBDemo engine=InnoDB;
Records: 0 Duplicates: 0 Warnings: 0

변환을 확인해야 합니다。

mysql> SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'test' and ENGINE = 'InnoDB';

이것은 출력입니다。

+--------------------+--------+
| TABLE_NAME            | ENGINE |
+--------------------+--------+
| myisamtoinnodbdemo | InnoDB |
+--------------------+--------+
1 row in set (0.00 sec)
Elasticsearch 튜토리얼