13.1.20.1 Files Created by CREATE TABLECREATE TABLE创建的文件

For an InnoDB table created in a file-per-table tablespace or general tablespace, table data and associated indexes are stored in a .ibd file in the database directory. 对于在每个表空间或常规表空间的文件中创建的InnoDB表,表数据和相关索引存储在数据库目录中的.ibd文件中。When an InnoDB table is created in the system tablespace, table data and indexes are stored in the ibdata* files that represent the system tablespace. 在系统表空间中创建InnoDB表时,表数据和索引存储在表示系统表空间的ibdata*文件中。The innodb_file_per_table option controls whether tables are created in file-per-table tablespaces or the system tablespace, by default. 默认情况下,innodb_file_per_table选项控制是在file-per-table表空间还是在系统表空间中创建表。The TABLESPACE option can be used to place a table in a file-per-table tablespace, general tablespace, or the system tablespace, regardless of the innodb_file_per_table setting.无论innodb_file_per_table设置如何,TABLESPACE选项可用于将表放置在每个表空间的文件、常规表空间或系统表空间中。

For MyISAM tables, the storage engine creates data and index files. 对于MyISAM表,存储引擎创建数据和索引文件。Thus, for each MyISAM table tbl_name, there are two disk files.因此,对于每个MyISAMtbl_name,都有两个磁盘文件。

File文件Purpose目的
tbl_name.MYDData file
tbl_name.MYIIndex file

Chapter 16, Alternative Storage Engines, describes what files each storage engine creates to represent tables. 第16章,“替代存储引擎”描述了每个存储引擎创建哪些文件来表示表。If a table name contains special characters, the names for the table files contain encoded versions of those characters as described in Section 9.2.4, “Mapping of Identifiers to File Names”.如果表名包含特殊字符,则表文件的名称包含这些字符的编码版本,如第9.2.4节,“标识符到文件名的映射”所述。