在MySQL中,数据库表分为三种类型:INNODB BDB MyISAM. 其中前2中支持数据库事物,而MyISAM不支持数据库事物。
在MySQL中,用create table 语句新建的表默认为MyISAM
如果希望创建INNODB类型的表
create table accounts{
id bigint not null,
name varchar(15),
balance decimal(10,2),
primary key (id)
}type = INNODB;
对于已经存在的表,可以采用以下的DDL语句修改它的表类型
alter table accounts type = INNODB