Home  >  Article  >  Database  >  How to view mysql error log

How to view mysql error log

青灯夜游
青灯夜游Original
2021-12-02 14:02:509495browse

How to view the mysql error log: 1. Use the "SHOW VARIABLES LIKE 'log_error'" command to obtain the path of the error log file; 2. Find the error log file with the ".err" suffix based on the obtained path, and Just open the file with Notepad and view the information in the file.

How to view mysql error log

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 view error log

The error log records the time when the MySQL service is started and closed, as well as what exceptions occur during the service operation, etc. information. If an exception occurs in the MySQL service, you can find the cause in the error log.

In MySQL, you can view the directory and file name information of the error log file through the SHOW command.

mysql> SHOW VARIABLES LIKE 'log_error';
+---------------+----------------------------------------------------------------+
| Variable_name | Value                                                          |
+---------------+----------------------------------------------------------------+
| log_error     | C:\ProgramData\MySQL\MySQL Server 5.7\Data\LAPTOP-UHQ6V8KP.err |
+---------------+----------------------------------------------------------------+
1 row in set, 1 warning (0.04 sec)

The error log is stored in the form of a text file and can be viewed directly using ordinary text tools. Open it here with Notepad, and you can know the file name of the error log from above. This file is in the default data path "C:\ProgramData\MySQL\MySQL Server 5.7\Data\". Open the LAPTOP-UHQ6V8KP.err file. Part of the content is as follows:

190906 22:06:45 InnoDB: Completed initialization of buffer pool
190906 22:06:45 InnoDB: highest supported file format is Barracuda.
190906 22:06:45  InnoDB: Waiting for the background threads to start
190906 22:06:46 InnoDB: 5.7.29 started; log sequence number 1605345
190906 22:06:47 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
190906 22:06:47 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
190906 22:06:47 [Note] Server socket created on IP: '0.0.0.0'.
190906 22:06:47 [Note] Event Scheduler: Loaded 0 events
190906 22:06:47 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.29-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)

The above is part of the error log file, which mainly records some operating errors of the system.

[Related recommendations: mysql video tutorial]

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

Statement:
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