MySQL如何查看启动日志的方法和命令操作步骤

MySQL启动日志可以帮助用户查看MySQL服务器的启动信息,以便于更好地管理MySQL服务器。下面介绍MySQL查看启动日志的方法和命令操作步骤:

1. 查看MySQL配置文件

MySQL的启动日志文件位于MySQL配置文件中,我们可以使用以下命令查看MySQL的配置文件:

mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.21-log Source distribution

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like '%log_error%';
+----------------------+---------------------------------------------+
| Variable_name        | Value                                       |
+----------------------+---------------------------------------------+
| log_error            | /var/lib/mysql/mysql-error.log               |
| log_error_verbosity  | 3                                           |
| log_output           | FILE                                        |
| log_queries_not_using_indexes | OFF                                  |
| log_slave_updates    | OFF                                         |
+----------------------+---------------------------------------------+
5 rows in set (0.00 sec)

从上面的输出中,可以看出MySQL的日志文件位于/var/lib/mysql/mysql-error.log,这就是MySQL的启动日志文件。

2. 查看MySQL启动日志

可以使用以下命令查看MySQL启动日志:

tail -f /var/lib/mysql/mysql-error.log

这样就可以查看MySQL启动日志的内容了,可以根据MySQL启动日志的内容更好地管理MySQL服务器。

本文链接:http://task.lmcjl.com/news/11188.html

展开阅读全文