存储引擎
以下数据基于mysql5.6
Innodb
Innodb是默认存储引擎,当然在创建表的时候可以显式指定
create table tb_innodb (id int(11),name varchar(32),age tinyint,primary key auto_increment (id)) engine=innodb;
mysql [mysql_data]> show create table tb_innodb;
+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tb_innodb | CREATE TABLE `tb_innodb` (
`id` int(11) NOT NULL DEFAULT \'0\',
`name` varchar(32) DEFAULT NULL,
`age` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
创建表后,会在data目录下生成文件:
tb_innodb.frm tb_innodb.ibd
其中:.frm 表定义文件, .ibd 数据文件
Myisam
create table tb_myisam (id int(11),name varchar(32),age tinyint,primary key auto_increment (id)) engine=myisam;
MySQL [mysql_data]> show create table tb_myisam;
+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tb_myisam | CREATE TABLE `tb_myisam` (
`id` int(11) NOT NULL DEFAULT \'0\',
`name` varchar(32) DEFAULT NULL,
`age` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
创建表后,会在data目录下生成文件:
tb_myisam.frm tb_myisam.MYD tb_myisam.MYI
其中:.frm 表定义文件 ,.ibd 数据文件 ,.myi 索引文件