NOTE

1.10 MySQL File System

1. Representation of Databases in the File System - Each database corresponds to a subdirectory under the data directory, or a folder 1. Create a subdirectory with the same name as the database under the data directory. 2. Create a file named db.opt under that subdirectory; this file contains various properties of the database, such as its character set and collation 2. Representation of Tables in the File System 2.1. MyISAM 2.2. InnoDB 3. Representation of Views in the File System

DatabasesCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. Representation of Databases in the File System

  • Each database corresponds to a subdirectory under the data directory, or a folder.
    1. Create a subdirectory (or folder) with the same name as the database under the data directory.
    2. Create a file named db.opt under that subdirectory. This file contains various properties of the database, such as the character set and collation used by the database.

2. Representation of Tables in the File System

2.1. MyISAM

  • table_name.frm: used to describe the table structure.
  • table_name.MYD: used to store table data.
  • table_name.MYI: used to store index data.

2.2. InnoDB

  • table_name.frm: used to describe the table structure.
  • table_name.ibd: used to store table data and indexes; this is also called a tablespace.

3. Representation of Views in the File System

  • A view is a virtual table and does not store real data, so only the table structure needs to be stored.
  • A view_name.frm file corresponds to it under the data directory.

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub