MySqlStudy-MySql Log Management I. Log File Types MySQL has several different log files, which can help you find out what happened inside mysqld: log File Information Content error log record start and run
MySqlStudy-MySql Log Management I. Log File Types MySQL has several different log files, which can help you find out what happened inside mysqld: log File Information Content error log record start and run
MySql Study-MySql Log Management
1. Log File Type
MySQL has several different log files to help you find out what happened inside mysqld:
Log Files
Log File Information
Error Log
Record the problems that occur when you start, run, or stop mysqld. (Log_err)
Query logs
Record the established client connection and executed statements.
Update log
The statement used to record and change data does not support this log.
Binary log
Records all statements for changing data. It is also used for replication. (Bin_log)
Slow log
Record all queries whose execution time exceeds long_query_time seconds or where no index is used. (Slow_query_log)
Ii. query the log storage location
Mysql> show variables like '% log % '; + metrics + | Variable_name | Value | + metrics + | back_log | 50 | binlog_cache_size | 32768 | binlog_checksum | NONE | binlog_direct_non_transactional_updates | OFF | binlog_format | STATEMENT | | binlog_row_image | FULL | bytes | OFF | binlog_stmt_cache_size | 32768 | expire_logs_days | 0 | general_log | OFF | general_log_file |/var/lib/mysql/rh6.log | bytes | 1 | bytes | OFF | innodb_log_buffer_size | 8388608 | innodb_log_file_size | 5242880 | innodb_log_files_in_group | 2 | innodb_log_group_home_dir |. /| metrics | 1 | innodb_undo_logs | 128 | log_bin | OFF | log_bin_basename | log_bin_index | metrics | OFF | log_error |/var/log/mysqld. log | log_output | FILE | logs | OFF | log_slave_updates | OFF | log_warnings | 1 | metrics | 18446744073709547520 | max_binlog_size | 1073741824 | metrics | 18446744073709547520 | max_relay_log_size | 0 | relay_log | relay_log_basename | relay_log_index | optional | relay-log.info | optional | FILE | relay_log_purge | ON | relay_log_recovery | OFF | optional | 0 | slow_query_log | OFF | slow_query_log_file |/var/lib/mysql/rh6-slow.log | SQL _log_bin | ON | SQL _log_off | OFF | sync_binlog | 0 | sync_relay_log | 0 | bytes | | + ----------------------------------------- + ----------------------------- + 47 rows in set (0.02 sec) mysql> show variables like '% log % '; + metrics + | Variable_name | Value | + metrics + | back_log | 50 | binlog_cache_size | 32768 | binlog_checksum | NONE | binlog_direct_non_transactional_updates | OFF | binlog_format | STATEMENT | | binlog_row_image | FULL | bytes | OFF | binlog_stmt_cache_size | 32768 | expire_logs_days | 0 | general_log | OFF | general_log_file |/var/lib/mysql/rh6.log | bytes | 1 | bytes | OFF | innodb_log_buffer_size | 8388608 | innodb_log_file_size | 5242880 | innodb_log_files_in_group | 2 | innodb_log_group_home_dir |. /| metrics | 1 | innodb_undo_logs | 128 | log_bin | OFF | log_bin_basename | log_bin_index | metrics | OFF | log_error |/var/log/mysqld. log | log_output | FILE | logs | OFF | log_slave_updates | OFF | log_warnings | 1 | metrics | 18446744073709547520 | max_binlog_size | 1073741824 | metrics | 18446744073709547520 | max_relay_log_size | 0 | relay_log | relay_log_basename | relay_log_index | optional | relay-log.info | optional | FILE | relay_log_purge | ON | relay_log_recovery | OFF | optional | 0 | slow_query_log | OFF | slow_query_log_file |/var/lib/mysql/rh6-slow.log | SQL _log_bin | ON | SQL _log_off | OFF | sync_binlog | 0 | sync_relay_log | 0 | bytes | | + ----------------------------------------- + ----------------------------- + 47 rows in set (0.02 sec)
1. Error Log (log_err specifies the location of the Error Log)
The error log file contains information about mysqld startup and shutdown, and any serious errors that occur on the server during running.