ITeye博客

mysql更改引擎(InnoDB,MyISAM)

siser344 · 2010-07-01 16:29 · mysql · 数据库 · Markdown

mysql默认的数据库引擎是MyISAM,不支持事务和外键,也可使用支持事务和外键的InnoDB。

查看当前数据库的所支持的数据库引擎以及默认数据库引擎

show engines;  

 

更改方式1:修改配置文件my.ini

我将my-small.ini另存为my.ini,在[mysqld]最后添加为上default-storage-engine=InnoDB,重启服务,数据库默认的引擎修改为InnoDB

更改方式2:在建表的时候指定或者建完表修改

--建表的时候指定   
create table mytbl(   
    id int primary key,   
    name varchar(50)   
)type=MyISAM;   
  
--建完表后修改   
alter table mytbl2 type = InnoDB;   
  
  
--查看修改结果(mytest为表所在的database名字)   
show table status from mytest;  

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。