将表从MyISAM转换为MySQL中的INNODB?

为此,请使用ALTER命令。让我们首先创建一个表。默认引擎设置为“ MYISAM”-

mysql> create table DemoTable
-> (
-> ClientId int NOT NULL AUTO_INCREMENT,
-> ClientName varchar(100),
-> ClientAge int,
-> ClientCountryName varchar(100),
-> isMarried boolean,
-> PRIMARY KEY(ClientId)
-> )ENGINE=MyISAM;

以下是将表从MyISAM转换为INNODB的查询-

mysql> alter table DemoTable ENGINE=InnoDB;
Records: 0 Duplicates: 0 Warnings: 0

现在让我们检查表的状态-

mysql> show create table DemoTable;

输出结果

这将产生以下输出,将更新的ENGINE显示为InnoDB-

+--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table        | Create Table                                                                                                                                                                                                                       |
+--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| DemoTable | CREATE TABLE `DemoTable` (`ClientId` int(11) NOT NULL AUTO_INCREMENT, `ClientName` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `ClientAge` int(11) DEFAULT NULL, `ClientCountryName` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `isMarried` tinyint(1) DEFAULT NULL, PRIMARY KEY (`ClientId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
+--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)