Detailed MySQL optimization configuration

Mysql5.7 official documentation: MySQL :: MySQL 5.7 Reference Manual

1. MySQL log

1. Error Log (Error Log)

The error log is one of the most important logs in MySQL. It records information about when mysqld (MySQL server) starts and stops, and when any serious errors occur while the server is running. This log can be viewed first when the database fails to function normally due to any failure.

Location and format of logs:

When starting MySQL, you can use the --log--error[file_name] option to specify the location where mysqld saves the error log file.

If no file_name value is given, mysqld will use the error log name host name.err (host_name is the host name), and write the log file in the directory specified by the parameter DATADIR (data directory) by default.

Error log path configuration in MySQL configuration file (/etc/my.cnf):

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysql/mysqld.log  # 定义错误日志的路径
pid-file=/run/mysqld/mysqld.pid

Use variables to view the path and information of the error log file:

show variables like 'log_error%';

2

Guess you like

Origin blog.csdn.net/qq_35029061/article/details/132133688