ALTER TABLE <表名> ENGINE=<存储引擎名>;
ENGINE 关键字用来指明新的存储引擎。
mysql> SHOW CREATE TABLE student \G
*************************** 1. row ***************************
Table: student
Create Table: CREATE TABLE `student` (
`stuId` int(4) DEFAULT NULL,
`id` int(4) DEFAULT NULL,
`name` varchar(20) DEFAULT NULL,
`stuno` int(11) DEFAULT NULL,
`sex` char(1) DEFAULT NULL,
`age` int(4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.01 sec)
可以看到,student 表当前的存储引擎为 InnoDB。ALTER TABLE student ENGINE=MyISAM;
mysql> SHOW CREATE TABLE student \G;
*************************** 1. row ***************************
Table: student
Create Table: CREATE TABLE `student` (
`stuId` int(4) DEFAULT NULL,
`id` int(4) DEFAULT NULL,
`name` varchar(20) DEFAULT NULL,
`stuno` int(11) DEFAULT NULL,
`sex` char(1) DEFAULT NULL,
`age` int(4) DEFAULT NULL,
`stuId2` int(4) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
default-storage-engine=存储引擎名称
然后保存就可以了。
版权说明:Copyright © 广州松河信息科技有限公司 2005-2025 版权所有 粤ICP备16019765号
广州松河信息科技有限公司 版权所有