Thursday, February 16, 2017


MySQL files extensions

grep data  /etc/my.cnf
datadir=/var/lib/mysql

We can finf below files in the `/var/lib/mysql/<db_name>`:

db.opt

this file contains characteristics of database like so:
default-character-set=latin1
default-collation=latin1_swedish_ci
every MyISAM table will have frm / MYD /  MYI and TRG (if this table has trigger)
.frm :
MySQL represents each table by an .frm table format file, stores table definition in the database directory. It is stored as  .frm under data directory.

.MYD :
This is the extension of the Data files for MyISAM tables.

.MYI :
This is the extension of the Index files for MyISAM tables.

<table_name>.TRG
contains SQL script of trigger for this table

<trigger_name>.TRN

contains a table name this trigger belongs to

.ibd :
If you specify innodb_file_per_table option to my.cnf, InnoDB stores each table in its own .ibd file in the same MySQL database directory where the .frm file is created. For InnoDB tables, the data and the indexes are stored together in the .ibd file.
 

No comments:

Post a Comment