MySQL更改数据库表的存储引擎

时间:2022-09-18 22:18:39

MySQL更改数据库表的存储引擎


1、查看表的原存储引擎

show create table user;

'user', 'CREATE TABLE `user` (\n  `id` int(11) NOT NULL DEFAULT \'0\',\n  `num` int(8) DEFAULT NULL,\n  `name` varchar(20) DEFAULT NULL,\n  `sex` varchar(10) DEFAULT NULL,\n  `age` int(3) DEFAULT NULL,\n  `phone` varchar(11) DEFAULT NULL,\n  `address` varchar(100) NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8'

2、修改存储引擎

alter table user engine=MyISAM;

3、查看修改后的存储引擎

'user', 'CREATE TABLE `user` (\n  `id` int(11) NOT NULL DEFAULT \'0\',\n  `num` int(8) DEFAULT NULL,\n  `name` varchar(20) DEFAULT NULL,\n  `sex` varchar(10) DEFAULT NULL,\n  `age` int(3) DEFAULT NULL,\n  `phone` varchar(11) DEFAULT NULL,\n  `address` varchar(100) NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8'