MySQL file _ MySQL

Source: Internet
Author: User
1. parameter file: this is the configuration file to be read during MySQL startup. you can use mysql -- help | grepmycnf to view the search sequence at startup. 20540 of these parameters depends on the default 20540 value specified during MySQL compilation, or the default 2 1 value specified in the source code. parameter file: this is the configuration file to be read when MySQL starts. you can use mysql -- help | grep my. cnf to view the search sequence at startup. The value of these parameters depends on the default value specified during MySQL compilation or the default value specified in the source code. You can use show variables to View database parameters, filter parameter names by using like, and search by using the information_schema.global_variables view. MySQL parameters can be divided into two types: a. static parameters cannot be changed throughout the instance life cycle, read-only. B. The dynamic parameters can be changed throughout the instance lifecycle. Run the SET | [global | session] system_var_name = expr | [@ global. | @ session. | @] system_var_name = expr command to change the value. Global indicates that this parameter is based on the life cycle of the entire instance, and session is based on the current session. 2. log files record various types of activities that affect the MySQL database. The following configuration file parameters affect the information and behavior of binary log records: max_binlog_size, binlog_cache_size, sync_binlog, binlog-do-db, binlog-ignore-db, log-slave-update, and binlog_format. What are the meanings of these parameters? I will write a special article in my blog to explain the parameters. I will not talk about them here. Common log files include a. error log, which records the startup, shutdown, and running processes of MySQL. When a problem occurs, you should first check the file to locate the problem. This file not only records all error information, but also records some warning information or correct information. Use show variables like 'log _ error' to locate the file location. By default, the file name of the error file is the host name of the server. B. The slow query log records SQL statements that may have "problems", so as to optimize the SQL statements. The format is FILE and TABLE (information_schema.slow_log). you can use the log_output (dynamic parameter) parameter to select the output format. Use the mysqldumpslow command to view the content of slow log files. Several situations recorded in this file: 1. set the threshold value recorded in this file using the long_query_time parameter. All SQL statements whose running time exceeds (greater than) this value are recorded. 2. set the long_queries_not_using_indexes parameter to record SQL statements that do not use indexes to slow log files. In MySQL, a new parameter log_throttle_queries_not_using_indexes is added to set the number of SQL statements that record slow logs and are not indexed per minute (mainly to prevent the slow log files from increasing frequently ). 3. specify the long_query_io parameter to record SQL statements that exceed the set logical IO count to the slow log file. C. binary log (binlog) records the execution of the intrauterine operation on the MySQL database. The main functions are as follows: 1. the restoration of some data requires binary logs. for example, after the full backup file of a database is restored, you can use the binary log to restore point-in-time. replication is mainly used on master-slave. 3. audit (audit) audits the information in binary logs to determine whether there is any injection attack to the database. D. The query log records all MySQL database requests, whether or not these requests are correctly executed. The default file name is host name. log. This log can also be recorded in the information_chema.general_log table starting with MySQL. 3. the socket file can be locally connected to MySQL in unix using the unix domain socket method. this method requires a socket file. The socket file can have the parameter socket control, which is generally in the/tmp directory and named mysql. sock. 4. when the MySQL instance is started, the pid file will write its process ID to a file (pid file ). This file can be controlled by the pid_file parameter. by default, it is located in the Database Directory and the file name is the host name. pid. 5. the table structure definition file MySQL data is stored according to the table. Each table has a corresponding file. Regardless of the storage engine used by the table, MySQL has a file suffixed with. frm, which records the table structure definition of the table. 6. the files described above in the InnoDB storage engine file are all files of the MySQL database and are irrelevant to the storage engine. In addition to these files, each table storage engine also has its own files. Files closely related to the InnoDB storage engine include redo log and tablespace ). 1. InnoDB stores stored data in tablespaces. By default, a file named ibdata1 with an initial size of 10 Mb is created. This file is the default tablespace file. you can set it through the innodb_data_file_path parameter. By default, data in the table of the InnoDB storage engine is recorded in the shared tablespace. However, you can use the innodb_file_per_table parameter to create an independent tablespace for each table based on the InnoDB storage engine. The independent tablespace only stores data, indexes, and inserted buffer BITMAP information of the table. the remaining information is stored in the default tablespace. 2. redo log files. by default, there will be two files named ib_logfile0 and ib_logfile1 in the data directory. Transaction logs of the InnoDB storage engine are recorded. When the database goes down, the InnoDB storage engine restores the redo logs to the time before the fault to ensure data integrity. The following parameters affect the attributes of the redo log file: innodb_log_file_size, innodb_log_files_in_group, innodb_mirrored_log_groups, innodb_log_group_home_dir

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.