Home > Database > Mysql Tutorial > How to enable error log in mysql

How to enable error log in mysql

青灯夜游
Release: 2022-06-17 17:57:41
Original
3719 people have browsed it

Opening method: 1. Open the "my.ini" configuration file and search for "[mysqld]"; 3. Under the "[mysqld]" group, add the "log_error" item and set the log storage location, syntax "log-error=dir/{filename}", where the "dir" parameter specifies the storage path of the error log, and the "filename" parameter specifies the file name of the error log. If the parameter after "log_error" is omitted, the file name defaults to the host name and is stored in the Data directory.

How to enable error log in mysql

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

The Error Log is the most commonly used log in MySQL. It mainly records information during the startup and stop process of the MySQL server, failures and exceptions that occur during the operation of the server, etc.

Mysql method to enable error log

In MySQL, open the my.ini configuration file and add the log_error option to the [mysqld] group , the form is as follows:

[mysqld]
log-error=dir/{filename}
Copy after login

Among them, the dir parameter specifies the storage path of the error log; the filename parameter specifies the file name of the error log; when the parameter is omitted, the file name defaults to the host name and is stored in the Data directory. .

After restarting the MySQL service, the parameters will take effect. You can see the filename.err file under the specified path. If filename is not specified, the error log will directly default to hostname.err.

For example, our log_error option configuration:

How to enable error log in mysql

How to enable error log in mysql

Note: Not all recorded in the error log are Error information, such as how MySQL starts InnoDB's table space file, how to initialize its own storage engine, etc., are also recorded in the error log file.

Note:

In the MySQL database, the error log function is enabled by default. Typically, the error log is stored in the data folder of the MySQL database, usually with the name hostname.err. Among them, hostname represents the host name of the MySQL server.

In the MySQL configuration file, the information recorded in the error log can be defined through log-error and log-warnings. Among them, log-err defines whether to enable the error log function and the storage location of the error log. log- warnings defines whether warning information is also logged to the error log.

[Related recommendations: mysql video tutorial]

The above is the detailed content of How to enable error log in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template