NOTE
1.10 MySQL File System
Each database has a subdirectory in the MySQL data directory. These notes examine how database creation relates to the files stored there.
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.
- Create a subdirectory (or folder) with the same name as the database under the data directory.
- Create a file named
db.optunder 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.
Drag to pan, scroll to zoom, and click a node to expand or collapse it. Large maps start with deeper levels collapsed; click nodes to expand them.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub