What is MYI, MYD and FRM in mysql

Sep-10th-2010

Hi,

Mysql data stores into /var/lib/mysql directory. Here is the content of a folder containing a database :

root@map007 [/var/lib/mysql]# ls -l cphulkd/
total 348
drwx——  2 mysql mysql   4096 Sep  8 21:37 ./
drwxr-x–x 85 mysql mysql   4096 Sep  8 08:05 ../
-rw-rw—-  1 mysql mysql   8590 Feb 28  2010 auths.frm
-rw-rw—-  1 mysql mysql   2570 Sep  8 21:37 auths.MYD
-rw-rw—-  1 mysql mysql   2048 Sep  9 00:30 auths.MYI
-rw-rw—-  1 mysql mysql   8664 Sep  8 21:37 brutes.frm
-rw-rw—-  1 mysql mysql   4076 Sep 10 00:10 brutes.MYD
-rw-rw—-  1 mysql mysql   4096 Sep 10 00:30 brutes.MYI
-rw-rw—-  1 mysql mysql     65 Feb 28  2010 db.opt
-rw-rw—-  1 mysql mysql   8672 Feb 28  2010 good_logins.frm
-rw-rw—-  1 mysql mysql      0 Feb 28  2010 good_logins.MYD
-rw-rw—-  1 mysql mysql   1024 Feb 28  2010 good_logins.MYI
-rw-rw—-  1 mysql mysql   8696 Sep  8 21:37 logins.frm
-rw-rw—-  1 mysql mysql 155940 Sep 10 00:56 logins.MYD
-rw-rw—-  1 mysql mysql  17408 Sep 10 00:56 logins.MYI
-rw-rw—-  1 mysql mysql   8556 Feb 28  2010 whitelist.frm
-rw-rw—-  1 mysql mysql      0 Feb 28  2010 whitelist.MYD
-rw-rw—-  1 mysql mysql   1024 Feb 28  2010 whitelist.MYI
root@map007 [/var/lib/mysql]#

MYI = index file
MYD = data file
FRM = format (schema) file

The db.opt file contains the database options.

Each frm file correspond to a table and every table has it’s frm file.

The backup for each table consists of its .frm format file and .MYD data file. The restore operation restores those files, and then uses them to rebuild the .MYI index file. Restoring takes longer than backing up due to the need to rebuild the indexes. The more indexes the table has, the longer it takes.

Mega World News Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon Weekend Joy

Add A Comment

*