10.4 How MySQL Uses Disk Space
The MySQL server uses disk space in several ways, primarily for directories and files that are located in the data directory. The server uses the data directory to store all the following:
Database directories. Each database corresponds to a single directory under the data directory, regardless of what types of tables you create in the database. For example, a given database is represented by one directory whether it contains MyISAM tables, InnoDB tables, or a mix of the two.
Table format files (.frm files). Every table has its own .frm file, located in the appropriate database directory. This is true no matter which storage engine manages the table.
Data and index files are created for each table by some storage engines. These files are placed in the appropriate database directory. For example, the MyISAM storage engine creates a datafile and an index file for each table. The BDB storage engine creates one file per table that includes both data and indexes.
The InnoDB storage engine has its own tablespace and log files. The tablespace contains data and index information for all InnoDB tables, as well as the undo logs that are needed if a transaction must be rolled back. The log files record information about committed transactions and are used to ensure that no data loss occurs. By default, the tablespace and log files are located in the data directory. The default tablespace file is named ibdata1 and the default log files are named ib_logfile0 and ib_logfile1.
General log files and status files. More information on these files is given in section 10.6, "Log and Status Files."