Innodb, MYISAM file storage structure

Each MySQL database corresponds to a file stored in a folder with the same name as the database, MySQL database files, including database files MySQLserver created files and MySQL database storage engine used to create.

View MySql database physical file location

 

 

 

1, MySQL create and manage database files:

.frm file: Frame store data table, the table with the same name as the file name, each table corresponds to a file with the same name frm, regardless of the operating system and the storage engine, i.e., regardless of what MySQL running on the operating system, which stores use engine, have this document.

In addition there must be .frm file, depending on the storage engine used by MySQL (MySQL storage engine is used both MyISAM and InnoDB), each storage engine creates a different spreadsheet file.

2, innodb data table file:

From the physical sense, InnoDB table from the shared space table, the log file group (redo file group), the table structure definition files. If innodb_file_per_table set to on, the system will generate a single file of a table_name.ibd (exclusive table space) for each table in this document, the internal data dictionary storage associated with the data table, the index table information . .Frm file table structure places the end, regardless of the storage engine.


Shared table space and table space are for the exclusive data from the physical sense

Shared table space: table will be stored in a centralized system table space. That is all the data tables for each database, index all the documents in a file. The file directory is the default data directory server. The default file name: ibdata1 initialized to 10M.

Exclusive table space: create a separate table for each table space at this time. In the corresponding database directory every table has .ibd file (this file contains data content and index the contents of a single table).


'% Innodb_file_per_table%' by show variables like; you can see what type of table space.

innodb_file_per_table = ON, a separate table is the table space.

 

 

 

By show variables like 'innodb_data%'; yield can look at the data file share storage path tablespace

 

 

 

 

Examples: Innodb exclusive table space

 

 

 

2.MyISAM database table file:

MyISAM table is independent of the operating system, indicating that can easily be ported from Windows servers to Linux servers; every time we build a MyISAM table engine, will create three files on a local disk, the file name is show . For example, I created a MyISAM engine test table, it will generate the following three documents:


test.frm, stores the table;
test.MYD, storing data;
test.MYI, stores the index.

 

Guess you like

Origin www.cnblogs.com/xingxia/p/mysql_myisam_innodb_data_struct.html