莆田网站建设费用,广东东莞出行最新政策,农村电商网站建设方案,免费做那个的视频网站文章目录 MySQL 8.0 架构 之错误日志文件#xff08;Error Log#xff09;#xff08;1#xff09;MySQL错误日志文件#xff08;Error Log#xff09;MySQL错误日志在哪里Window环境Linux环境 错误日志相关参数log_error_services 参考 【声明】文章仅供学习交流#x… 文章目录 MySQL 8.0 架构 之错误日志文件Error Log1MySQL错误日志文件Error LogMySQL错误日志在哪里Window环境Linux环境 错误日志相关参数log_error_services 参考 【声明】文章仅供学习交流观点代表个人与任何公司无关。 编辑|SQL和数据库技术(ID:SQLplusDB) MySQL 8.0 OCP (1Z0-908) 考点概要
MySQL 8.0 OCP (1Z0-908) 考点精析-安装与配置考点1设置系统变量 【MySQL】控制MySQL优化器行为方法之optimizer_switch系统变量 【MySQL】MySQL系统变量system variables列表mysqld --verbose --help的结果例 【MySQL】MySQL系统变量system variables列表SHOW VARIABLES 的结果例 MySQL 8.0 OCP (1Z0-908) 考点精析-备份与恢复考点1MySQL Enterprise Backup概要 MySQL 8.0 OCP (1Z0-908) 考点精析-性能优化考点1sys.statement_analysis视图 MySQL 8.0 OCP (1Z0-908) 考点精析-性能优化考点2系统变量的确认 MySQL 8.0 OCP (1Z0-908) 考点精析-性能优化考点3EXPLAIN ANALYZE MySQL 8.0 OCP (1Z0-908) 考点精析-性能优化考点4慢速查询日志slow query log MySQL 8.0 OCP (1Z0-908) 考点精析-性能优化考点5表连接算法join algorithm MySQL 8.0 OCP (1Z0-908) 考点精析-性能优化考点6MySQL Enterprise Monitor之Query Analyzer MySQL 8.0 OCP (1Z0-908) 考点精析-架构考点1二进制日志文件Binary log MySQL 8.0 OCP (1Z0-908) 考点精析-架构考点5数据字典(Data Dictionary) MySQL 8.0 OCP (1Z0-908) 考点精析-架构考点6InnoDB Tablespaces之系统表空间System Tablespace MySQL 8.0 InnoDB Tablespaces之File-per-table tablespaces单独表空间 MySQL 8.0 InnoDB Tablespaces之General Tablespaces通用表空间/一般表空间 【MySQL】在数据目录之外创建InnoDB 表Creating Tables Externally MySQL 8.0 InnoDB Tablespaces之Temporary Tablespaces临时表空间 MySQL 8.0 InnoDB 架构之 日志缓冲区Log Buffer和重做日志Redo Log MySQL 8.0 架构 之错误日志文件Error Log1
MySQL 8.0 架构 之错误日志文件Error Log1
MySQL中有多种类型的日志文件这些日志可用于故障排除、性能调整和审计等目的帮助找出正在发生的活动。
常见的日志文件包括
日志类型写入日志的信息错误日志Error log启动、运行或停止mysqld时遇到的问题二进制日志Binary log更改数据的语句也用于复制中继日志Relay log从复制源服务器接收到的数据更改通用查询日志General query log已建立的客户端连接和从客户端接收到的语句慢查询日志Slow query log执行时间超过long_query_time秒的查询DDL日志元数据日志DDL logDDL语句执行的元数据操作
MySQL错误日志文件Error Log
错误日志Error Log主要用于记录 MySQL 服务器启动和停止过程中的信息、以及服务器在运行过程中发生的故障和异常情况等信息。另外错误日志功能默认为开启状态。
MySQL错误日志在哪里
通过log_error参数可以查看错误日志的路径和文件名。
方法1在MySQL的配置文件my.cnf或my.ini中搜索log_error参数方法2通过MySQL的SHOW 命令命令查看log_error参数
log_error参数
Command-Line Format–log-error[file_name]System Variablelog_errorScopeGlobalDynamicNoSET_VAR Hint AppliesNoTypeFile name
参考 log_error https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_log_error
Window环境
在Window环境中错误日志默认存储在 MySQL 数据库的数据文件夹下通常名称为 hostname.err。 其中hostname 表示 MySQL 服务器的主机名。
例
mysql show variables like log_error;
--------------------------------------
| Variable_name | Value |
--------------------------------------
| log_error | .\PC-202106271542.err |
--------------------------------------
1 row in set, 1 warning (0.11 sec)mysql show variables like datadir;
--------------------------------------------
| Variable_name | Value |
--------------------------------------------
| datadir | E:\Soft\MySQL8.0\data\Data\ |
--------------------------------------------
1 row in set, 1 warning (0.00 sec)mysql通过上面的内容可以看到错误日志为E:\Soft\MySQL8.0\data\Data\PC-202106271542.err。 错误日志以文本文件的形式存储可以通过普通文本工具查看。
错误日志输出例
2024-01-13T22:40:14.008389Z 0 [System] [MY-010116] [Server] E:\Soft\MySQL8.0\bin\mysqld.exe (mysqld 8.0.28) starting as process 2436
2024-01-13T22:40:16.764578Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-01-13T22:40:22.142343Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-01-13T22:40:26.603871Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-01-13T22:40:26.605011Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-01-13T22:40:28.060801Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: :: port: 33060
2024-01-13T22:40:28.061433Z 0 [System] [MY-010931] [Server] E:\Soft\MySQL8.0\bin\mysqld.exe: ready for connections. Version: 8.0.28 socket: port: 3306 MySQL Community Server - GPL.Linux环境
在Linux环境中错误日志默认存储在 /var/log/mysql/文件夹下通常名称为error.log 。
例
mysql show variables like log_error;
-----------------------------------------
| Variable_name | Value |
-----------------------------------------
| log_error | /var/log/mysql/error.log |
-----------------------------------------
1 row in set (0.00 sec)文件如下
rootmysql-vm:/var/log/mysql# ls -l
total 32
-rw-r----- 1 mysql adm 446 Dec 30 06:49 error.log
-rw-r----- 1 mysql adm 297 Dec 29 23:20 error.log.1.gz
-rw-r----- 1 mysql adm 1844 Dec 28 20:55 error.log.2.gz
-rw-r----- 1 mysql adm 20 Dec 27 21:19 error.log.3.gz
-rw-r----- 1 mysql adm 20 Dec 26 21:04 error.log.4.gz
-rw-r----- 1 mysql adm 1165 Dec 24 22:11 error.log.5.gz
-rw-r----- 1 mysql adm 389 Dec 23 09:07 error.log.6.gz
-rw-r----- 1 mysql adm 248 Dec 20 20:29 error.log.7.gz
rootmysql-vm:/var/log/mysql#可以通过cat、more等linux命令查看错误日志文件。 例
rootmysql-vm:/var/log/mysql# more error.log
2023-12-29T17:31:18.719726Z 23 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: mysql_native_pass
word is deprecated and will be removed in a future release. Please use caching_sha2_password instead
2023-12-29T22:49:18.399315Z 24 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: mysql_native_pass
word is deprecated and will be removed in a future release. Please use caching_sha2_password instead
rootmysql-vm:/var/log/mysql#对于gz的备份文件可以通过zcat 命令查看。 例
rootmysql-vm:/var/log/mysql# zcat error.log.5.gz |more
2023-12-24T13:54:59.579065Z 28 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: mysql_native_pass
word is deprecated and will be removed in a future release. Please use caching_sha2_password instead
2023-12-24T14:00:25.985956Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user via user signal. Shutting downmysqld (Version: 8.0.35-0ubuntu0.22.04.1).
2023-12-24T14:00:28.013493Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 28 user: root.
2023-12-24T14:00:29.246031Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.35-0ubuntu0.
22.04.1) (Ubuntu).
2023-12-24T14:01:51.652180Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.35-0ubuntu0.22.04.1) starting a
s process 14125
2023-12-24T14:01:51.662665Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-12-24T14:01:52.129208Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-12-24T14:01:52.441482Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-12-24T14:01:52.441522Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted conn
ections are now supported for this channel.
2023-12-24T14:01:52.485270Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: 127.0.0.1 po
rt: 33060, socket: /var/run/mysqld/mysqlx.sock
2023-12-24T14:01:52.485511Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: 8.0.35-0u
buntu0.22.04.1 socket: /var/run/mysqld/mysqld.sock port: 3306 (Ubuntu).
错误日志相关参数
log_error_services
Command-Line Format–log-error-servicesvalueSystem Variablelog_error_servicesScopeGlobalDynamicYesSET_VAR Hint AppliesNoTypeStringDefault Valuelog_filter_internal; log_sink_internal
参考 log_error_services https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_log_error_services
参考
27.12.21.2 The error_log Table https://dev.mysql.com/doc/refman/8.0/en/performance-schema-error-log-table.html 5.4.2 The Error Log https://dev.mysql.com/doc/refman/8.0/en/error-log.html
https://dev.mysql.com/doc/refman/8.0/en/log-file-maintenance.html