MySQL Architecture 2/2
• Disk space Usage
• Memory usage
The Data Directory
• /usr/local/mysql/var (source)
• /var/lib/mysql (pkg)
• \PF\MYSQL 5.1\ Data (Win)
[MySQLD]
• Datadir=/var/lib/mysql2
• Datadir=c:/mysql
• Shell> mysql –verbose –help ==reveals opt.files parse
order
MyISAM File Structures
• Each DB gets own folder under datadir
• Myd: table data file
• Myi: table index file
• Frm : table schema file
• Schema = database =logical container =
physical folder
InnoDB File Structures
• Files Stored in datadir root
• Tablespace (data + index)
--ibdata
• Transaction log files – ib_log file1, ib_log file2
• Table format files -. Frm
[MySQLD]
• Innodb_data_per_table
Mysql logs
• Stored in datadir
• Accessed through mysql client
MySQL Memory usage
• Thread = process = connection = client thread handlers
• Buffers (memory catches)
– --table cache : open tables
– --grant table buffers : privileges
– --key buffers : index blocks
– --query cache : execution plans
• Demo
• Examining Table File Structures
• Customizing ‘’ “ “
• Working with datadir…. Login…
…
MySQL> show create table city;
…
…
…
…
…
…
• After datadir change to newdatadir
…