Whenever MySQL database installation is done, all the database related data and metadata are stored in one folder.This is the actual database schema with some values in it.Let us explore more about it.
The file extensions are as follows:
- .frm – This is the extension of file which contains the schema or definition of the table.
- .myd – This is the extension of file which contains MyISAM table data.
- .myi – This is the extension of file which contains MyISAM table indices.
Inside the MySQL Server 5.5/data/mysql folder, some of the files are *.frm, *.MYD, and *.MYI,
where the asterisks are actual table names. If the MyISAM engine is used, the data folder will contain all the above files, otherwise in the case of InnoDB, the folder contains .frm files.
These database files are used for backup purpose for securing schema, data and indexes for some migration or upgrade of the database. The configuration files for MySQL for Windows and Linux are my.ini and my.conf respectively.
The Path for Windows:
C:\Program Files\MySQL\MySQL Server 5.5\my.ini
In my.ini file, if we search the keyword basedir, we can get the path of the MySQL server installation.
In the similar way, if we search the keyword datadir, we can get the path of the Database root. Apart from this, there are many other files which are created or used by MySQL server to perform various activities. Some of them are as follows
Its a MySQL database configuration file. This is the main configuration file of MySQL server.
This is found in the root directory where the installation is done. In this file, the user can find the location of data folder.
The default location of the configuration file is ‘/etc/my.cnf‘
Other file formats which are compatible with MySQL are .ibc, .tmd, .rul, .cnf, .ddl, .ibd, .mysql, .sql, .opt.
Depending on the table type, tables are stored in files with these extensions.
Whenever database is created or changed using MySQL commands, the characteristics of database are stored in text file namely db.opt file .
These are the files with extensions *.ibd which stores the data and index of MySQL InnoDB tables. This type of file is created or used by MySQL InnoDB software and associated with it .
All the MySQL database connections are managed by a special file called the socket file. This socket file namely mysqld.sock is created by MySQL service automatically which helps in communicating between different processes.
Pid file :
The process id of MySQL server is written in such file. The default will be hostname of the MySQL server.
These are the files with extensions ‘ .db ‘ which stores the data and indexes of BerkeleyDB storage engine.
error log :
The error log file really plays an important role during troubleshooting of application. These are MySQL error log files which will give the exact reason or information for MySQL failure in the server. This effectively helps in the debug process for any error issue raised in MySQL server. By default it will log errors in hostname.err file.
Slow Query Log :
Slow query log file have all the ‘ slow ‘ SQL queries. The performance of the application goes down because of the MySQL queries taking more time to complete than the expected result. So this helps in monitoring the slow queries which helps in improving the queries for higher performance.
general query log :
General query log file gives all the general details like server start or end timimgs, up or down details, connect or disconnect details etc. It is enabled by log[=filename]. By default, MySQL will create hostname.log for the entries .
binary log files :
The binary log files contains detail information related to any table creation or data modifications made to MySQL server. This also have informations regarding the time taken by MySQL statement, state of the server, error codes, metadata for maintenance of log file. This is enabled by -log-bin[=basename] option. By default, its hostname of the server.
To monitor which binary log files are used, a binary log index file is created which contains the names of all binary log files. It is enabled by –log-bin-index[=filename] else basename will be the binary log file with the extension .index. By default, relay log index file name is host_name-relay-bin.index .
These are the intermediate database file created by MySQL server created during repair operations. This file contains information regarding database recoveries. These files are also be created by some other MySQL database operations.
TRG and TRN Files :
TRG files are trigger parameter files and TRN files are trigger namespace files. In MySQL server, whenever triggers are defined, the definitions are stored in text files namely
tablename.TRG file. It contains triggers for multiple events like BEFORE or AFTER of INSERT, UPDATE or DELETE operations in MySQL.
.ARZ, .ARM and .ARN files :
The table data and table metadata files have extensions of .ARZ and .ARM respectively. An .ARN file is the optimization file during optimization process. The files are related to Archive Storage Engine.
ARZ files are the metadata files for archive tables. The files with this extension stores data for table. The files are included in the backups created by mysqlbackup command of MySQL.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- PHP | MySQL Database Introduction
- Database Backup from MySQL
- PHP | Inserting into MySQL database
- PHP | MySQL ( Creating Database )
- MySQL | DATABASE() and CURRENT_USER() Functions
- How to add Image to MySql database using Servlet and JDBC
- Difference between Centralized Database and Distributed Database
- How to pre populate database in Android using SQLite Database
- MySQL | Common MySQL Queries
- MySQL | IF( ) Function
- PHP | MySQL WHERE Clause
- MySQL | BIN() Function
- MySQL | MD5 Function
- IFNULL in MySQL
- How to get ID of the last updated row in MySQL?
- MongoDB vs MySQL
- Difference between MySQL and IBM Db2
- MySQL | CONNECTION_ID( ) Function
- MySQL | Group_CONCAT() Function
- MySQL | DEFAULT() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.