查看表的存储引擎用命令 show create table 表名

更改表的存储引擎用命令 alter table 表名 set ENGINE=新引擎名

示例如下:

mysql> show create table t01;
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                             |
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
| t01   | CREATE TABLE `t01` (
  `id` int(11) NOT NULL,
  `name` varchar(22) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.05 sec)

mysql> alter table t01 engine=MyISAM;
Query OK, 0 rows affected (0.23 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> show create table t01;
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                             |
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
| t01   | CREATE TABLE `t01` (
  `id` int(11) NOT NULL,
  `name` varchar(22) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql>

玩完后记得改回原样哦。

mysql> alter table t01 ENGINE=INNODB;
Query OK, 0 rows affected (0.14 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> show create table t01;
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                             |
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
| t01   | CREATE TABLE `t01` (
  `id` int(11) NOT NULL,
  `name` varchar(22) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

 

--END--

相关文章:

  • 2021-09-01
  • 2022-02-09
  • 2021-12-01
  • 2021-12-08
  • 2021-06-13
  • 2022-12-23
猜你喜欢
  • 2021-05-20
  • 2021-08-09
  • 2022-03-07
  • 2021-09-19
  • 2021-10-24
  • 2021-12-07
相关资源
相似解决方案