The files in MySQL!!

Source: Internet
Author: User


Files in MySQL


Parameter file: MySQL configuration file, save the configuration information of MySQL. File name my.cnf

By default, the MySQL instance reads the configuration file in a certain order in the specified file, and the user can

MySQL--help | grep my.cnf to find the configuration file

You can also find the my.cnf file by using the Whereis command

[[email protected] ~]# MySQL--help | grep my.cnf

Order of preference, MY.CNF, $MYSQL _tcp_port,

/ETC/MYSQL/MY.CNF/ETC/MY.CNF ~/.my.cnf

[Email protected] ~]# Whereis my.cnf

my:/etc/my.cnf


Error log file: Record the startup, run, and shutdown process for MySQL.

Viewing the error log

Mysql> show global variables like ' log%error% ';

+---------------+-------------------------------+

| variable_name | Value |

+---------------+-------------------------------+

| Log_error | /home/data/192.168.57.132.err |

+---------------+-------------------------------+



Slow query log files: Record time-consuming queries or queries that do not use indexes to optimize the database.

Variables related to slow queries

Log_output: Full query log and query log output format, by default is file

, you can change the table to a table, and the slow query SQL record is in Mysql.slow_log

Mysql> show global variables like ' log_output% ';

+---------------+-------+

| variable_name | Value |

+---------------+-------+

| Log_output | TABLE |

+---------------+-------+

1 row in Set (0.00 sec)


mysql> set global log_output= ' table ';

Query OK, 0 rows Affected (0.00 sec)


Log_queries_not_using_indexes: Query not used to index is logged to slow query log, default is off

Log_slow_queries: Whether to enable slow query logging. Default is Off

Slow_query_log_file: path to slow query log file

Slow_query_log: Whether to turn on the slow query log, the same variable and log_slow_queries function

Long_query_time: Slow query threshold, default is 10s

How to use slow query logs for performance tuning: http://dwchaoyue.blog.51cto.com/2826417/1555269


Query log: All information about the MySQL database requests is logged, regardless of whether the requests are executed correctly. Output format

The same is controlled by Log_output.

General_log: Whether to open the query log

General_log_file: The path to the query log file

Mysql> show global variables like ' general% ';

+------------------+--------------------+

| variable_name | Value |

+------------------+--------------------+

| General_log | On |

| General_log_file | /home/data/192.log |

+------------------+--------------------+


Socket file: Unix System a way to connect to MySQL locally

Mysql> show global variables like '%sock% ';

+---------------+-----------------------+

| variable_name | Value |

+---------------+-----------------------+

| sockets | /home/data/mysql.sock |

+---------------+-----------------------+

1 row in Set (0.00 sec)


PID file: The process ID used to save the MySQL instance, the path can be controlled by pid_file

Mysql> show global variables like '%pid% ';

+---------------+-------------------------------+

| variable_name | Value |

+---------------+-------------------------------+

| Pid_file | /home/data/192.168.57.132.pid |

+---------------+-------------------------------+


Table structure definition file: Saves the structure of the table, with the suffix. frm, regardless of what storage engine the table uses, there is a. frm file that corresponds to the table structure.

Extension: also includes. MYD (data) for the MyISAM storage engine. MYI (index) file

[email protected] csevent]# LL

Total 988

-RW-RW----. 1 mysql mysql 8790 Sep 03:57 cm_announce.frm

-RW-RW----. 1 mysql mysql 9012 Sep 03:57 cm_block_game_accounts.frm

-RW-RW----. 1 mysql mysql 8640 Sep 03:57 cm_bug_types.frm

-RW-RW----. 1 mysql mysql 8714 Sep 03:57 cm_c2corder_locked.frm

-RW-RW----. 1 mysql mysql 8754 Sep 03:57 cm_client_system.frm


Tablespace files: The InnoDB storage engine stores data in a tablespace file. All data that is based on the INNODB storage engine is stored in a table space.

Partial variables related to table space:

Mysql> show global variables like ' innodb_data_% ';

+-----------------------+------------------------+

| variable_name | Value |

+-----------------------+------------------------+

| Innodb_data_file_path | Ibdata1:10m:autoextend |

|                        Innodb_data_home_dir | |

+-----------------------+------------------------+


Redo log files: transaction log files, which are unique to the InnoDB storage engine.

Partial variables related to redo logs

Mysql> show global variables like ' innodb_log_% ';

+---------------------------+---------+

| variable_name | Value |

+---------------------------+---------+

| Innodb_log_buffer_size | 1048576 |

| Innodb_log_file_size | 5242880 |

| Innodb_log_files_in_group | 2 |

| Innodb_log_group_home_dir |./|

+---------------------------+---------+


Binary log: All operations performed on the MySQL database are logged.

Partial variables related to binary logs

Mysql> show global variables like ' binlog% ';

+-----------------------------------------+-----------+

| variable_name | Value |

+-----------------------------------------+-----------+

| Binlog_cache_size | 32768 |

| Binlog_direct_non_transactional_updates | OFF |

| Binlog_format | STATEMENT |

+-----------------------------------------+-----------+


Here is a brief overview of the MySQL-related files, where tablespace files, redo transaction log files, binary files

Is the most important document, which will be reviewed in detail later in this paper.



This article is from the "SQL Server MySQL" blog, so be sure to keep this source http://dwchaoyue.blog.51cto.com/2826417/1572705

The files in MySQL!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.