为此,请使用 ALTER 命令。让我们首先创建一个表。默认引擎设置为“MYISAM” -Mysql> create table DemoTable -> ( -> ClientId int NOT NULL AUTO_IN
为此,请使用 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;
Query OK, 0 rows affected (0.67 sec)
以下是将表从 MyISAM 转换为 INNODB 的查询 -
mysql> alter table DemoTable ENGINE=InnoDB;
Query OK, 0 rows affected (1.97 sec)
Records: 0 Duplicates: 0 Warnings: 0
现在让我们检查表的状态 -
mysql> show create table DemoTable;
这将产生以下输出,将更新后的引擎显示为 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)
--结束END--
本文标题: 在 MySQL 中将表从 MyISAM 转换为 INNODB?
本文链接: https://lsjlt.com/news/436958.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0