一. 通过配置文件修改存储引擎
打开my.ini文件,一般存储在C:\Program Files\MySQL\MySQL Server x.x目录下,打开文件后,搜索:default-storage-engine,然后设置成default-storage-engine=存储引擎名字即可
二. 通过创建数据表的命令实现
CREATE TABLE table_name ( ... ... ) ENGINE = engine;
比如:
mysql> CREATE TABLE test2 ( -> s1 VARCHAR(10) -> )ENGINE = MyISAM; Query OK, 0 rows affected (0.01 sec) mysql> SHOW CREATE TABLE test2; +-------+-----------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+-----------------------------------------------------------------------------------------------+ | test2 | CREATE TABLE `test2` ( `s1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | +-------+-----------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
三. 修改存储引擎
可以通过ALTER TABLE来修改存储引擎:
ALTER TABLE table_name ENGINE [=] engine_name;
比如:
mysql> ALTER TABLE test2 ENGINE = InnoDB; Query OK, 0 rows affected (0.02 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> SHOW CREATE TABLE test2; +-------+-----------------------------------------------------------------------------------------------+ | Table | Create Table | +-------+-----------------------------------------------------------------------------------------------+ | test2 | CREATE TABLE `test2` ( `s1` varchar(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | +-------+-----------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
请登录之后再进行评论