在介绍这个参数前,我们先聊聊参数log_warnings。我们知道MySQL中,其中log_error定义是否启用错误日志的功能和错误日志的存储位置,log_warnings定义是否将告警信息(warning messages)也写入错误日志。此选项默认启用,具体来说:

log_warnings 为0, 表示不记录告警信息。

log_warnings 为1, 表示告警信息写入错误日志。

log_warnings 大于1, 表示各类告警信息,例如有关网络故障的信息和重新连接信息写入错误日志。

注意,此参数在不同版本略有差别,在MySQL 5.6中,log_warnings的默认值为1,如下所示:

Property

Value

Command-Line Format

--log-warnings[=#]

System Variable

log_warnings

Scope (>= 5.6.4)

Global

Scope (<= 5.6.3)

Global, Session

Dynamic

Yes

Type (64-bit platforms)

integer

Type (32-bit platforms)

integer

Default Value (64-bit platforms)

1

Default Value (32-bit platforms)

1

Minimum Value (64-bit platforms)

0

Minimum Value (32-bit platforms)

0

Maximum Value (64-bit platforms)

18446744073709551615

Maximum Value (32-bit platforms)

4294967295

在MySQL 5.7中,有些版本默认值为2,有些版本默认值为1, 具体参考官方文档信息,如下所示:

Property

Value

Command-Line Format

--log-warnings[=#]

Deprecated

5.7.2

System Variable

log_warnings

Scope

Global

Dynamic

Yes

Type (64-bit platforms)

integer

Type (32-bit platforms)

integer

Default Value (64-bit platforms, >= 5.7.2)

2

Default Value (64-bit platforms, <= 5.7.1)

1

Default Value (32-bit platforms, >= 5.7.2)

2

Default Value (32-bit platforms, <= 5.7.1)

1

Minimum Value (64-bit platforms)

0

Minimum Value (32-bit platforms)

0

Maximum Value (64-bit platforms)

18446744073709551615

Maximum Value (32-bit platforms)

4294967295

Print out warnings such as Aborted connection... to the error log. This option is enabled (1) by default. To disable it, use --log-warnings=0. Specifying the option without a level value increments the current value by 1. Enabling this option by setting it greater than 0 is recommended, for example, if you use replication (you get more information about what is happening, such as messages about network failures and reconnections). If the value is greater than 1, aborted connections are written to the error log, and access-denied errors for new connection attempts are written. See Section B.5.2.11, “Communication Errors and Aborted Connections”.

If a slave server was started with --log-warnings enabled, the slave prints messages to the error log to provide information about its status, such as the binary log and relay log coordinates where it starts its job, when it is switching to another relay log, when it reconnects after a disconnect, and so forth. The server logs messages about statements that are unsafe for statement-based logging if --log-warnings is greater than 0.

将告警信息,例如连接中断等告警信息输出到错误日志。该选项默认启用(默认值为1)。要禁用它,请使用--log-warnings = 0选项。指定没有级别值的选项时,将当前值递增1. 推荐将这个值设置为大于0启用告警日志信息写入错误日志。举个例子,如果你正在使用复制(你将会获取正在发生的事情的更多详细信息,例如有关网络故障的信息和重新连接信息)。如果该值大于1,连接中断将写入错误日志,新的连接尝试访问的拒绝访问信息。参见第B.5.2.11节“通信错误和中止连接”。

如果从服务器(slave server)启动时启用了--log-warnings,则从设备将消息输出到错误日志中以提供有关其状态的信息,例如二进制日志和中继日志坐标,它在开始作业时切换到另一个中继日志,断开连接后重新连接等等。如果--log-warnings大于0,服务器将记录关于对基于语句的日志不安全的语句的消息。

注意:从MySQL 5.7.2开始,首选log_error_verbosity系统变量,而不是使用--log-warnings选项或log_warnings系统变量,这个参数从MySQL 8.0.3开始被移除了:

This system variable was removed in MySQL 8.0.3. Use the log_error_verbosity system variable instead.

而新参数log_error_verbosity更简单,它有三个可选值, 分别对应:1 错误信息;2  错误信息和告警信息; 3:错误信息、告警信息和通知信息。 具体参考官方文档,下面部分截取官方文档。

log_error_verbosity

Property

Value

Command-Line Format

--log-error-verbosity=#

System Variable

log_error_verbosity

Scope

Global

Dynamic

Yes

SET_VAR Hint Applies

No

Type

integer

Default Value (>= 8.0.4)

2

Default Value (<= 8.0.3)

3

Minimum Value

1

Maximum Value

3

The verbosity for handling events intended for the error log, as filtered by the log_filter_internal error log filter component. log_error_verbosity has no effect if log_filter_internal is not enabled.

The following table shows the permitted verbosity values.

Desired Log Filtering

log_error_verbosity Value

Error messages

1

Error and warning messages

2

Error, warning, and note messages

3

Selected important system messages about non-error situations, such as startup and shutdown messages, are printed to the error log when the variable value is 1.

For additional information, see Section 5.4.2.5, “Error Log Filtering”, and Section 5.5.1, “Error Log Components”.

参考资料:

https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_log_warnings

https://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_log-warnings

MySQL新参数log_error_verbosity的更多相关文章

  1. 1201MySQL配置文件mysql.ini参数详解

    转自http://www.cnblogs.com/feichexia/archive/2012/11/27/mysqlconf.html my.ini(Linux系统下是my.cnf),当mysql服 ...

  2. (转)MySQL配置文件mysql.ini参数详解、MySQL性能优化

    本文转自:http://www.cr173.com/html/18331_1.html my.ini(Linux系统下是my.cnf),当mysql服务器启动时它会读取这个文件,设置相关的运行环境参数 ...

  3. MySQL配置文件mysql.ini参数详解、MySQL性能优化

    my.ini(Linux系统下是my.cnf),当mysql服务器启动时它会读取这个文件,设置相关的运行环境参数. my.ini分为两块:Client Section和Server Section.  ...

  4. MySQL配置文件mysql.ini参数详解

    my.ini(Linux系统下是my.cnf),当mysql服务器启动时它会读取这个文件,设置相关的运行环境参数. my.ini分为两块:Client Section和Server Section. ...

  5. MySql配置参数很全的Mysql配置参数说明

    MySql配置参数 很全的Mysql配置参数说明 1. back_log 指定MySQL可能的连接数量.当MySQL主线程在很短的时间内得到非常多的连接请求,该参数就起作用,之后主线程花些时间(尽管很 ...

  6. MySQL 存储过程参数

    MySQL  存储过程参数 MySQL存储过程参数简介 在现实应用中,开发的存储过程几乎都需要参数.这些参数使存储过程更加灵活和有用. 在MySQL中,参数有三种模式:IN,OUT或INOUT. IN ...

  7. MySQL wait_timeout参数修改

    MySQL wait_timeout参数修改问题,可能经常会有DBA遇到过,下面就试验一下并看看会有什么现象. wait_timeout分为global级及session级别,如未进行配置,默认值为2 ...

  8. 看MySQL的参数调优及数据库锁实践有这一篇足够了

    史上最强MySQL参数调优及数据库锁实践 1. 应用优化 1.2 减少对MySQL的访问 1.2.1 避免对数据进行重复检索 1.2.2 增加cache层 1.3 负载均衡 1.3.1 利用MySQL ...

  9. MySQL 配置参数优化

    MySQL 配置参数优化 1.修改back_log参数值:由默认的50修改为500 back_log=500back_log值指出在MySQL暂时停止回答新请求之前的短时间内多少个请求可以被存在堆栈中 ...

随机推荐

  1. [Swift]LeetCode954. 二倍数对数组 | Array of Doubled Pairs

    Given an array of integers A with even length, return true if and only if it is possible to reorder ...

  2. Solaris 11 配置IP地址

    查看ipipadm show-addr 删除IP地址ipadm delete-addr net0/v4 配置IP地址ipadm create-addr –T static –a local=10.90 ...

  3. asp.net core 系列 15 中间件

    一.概述 中间件(也叫中间件组件)是一种装配到应用管道以处理请求和响应的软件. 每个组件:(1)选择是否将请求传递到管道中的下一个组件;(2)可以在管道中的下一个组件之前和之后执行工作. 请求委托用于 ...

  4. APK安装成功后点击"打开",按Home键,在桌面点击图标后应用重启

    转载:http://blog.csdn.net/kepoon/article/details/7468688 问题: 安装系统SD卡里面的apk或者原有的程序更新版本的时候,会遇到升级安装成功之后的一 ...

  5. 15-Flink实战项目之实时热销排行

    戳更多文章: 1-Flink入门 2-本地环境搭建&构建第一个Flink应用 3-DataSet API 4-DataSteam API 5-集群部署 6-分布式缓存 7-重启策略 8-Fli ...

  6. 使用kubeadm部署Kubernetes集群

    一.环境架构与部署准备 1.集群节点架构与各节点所需安装的服务如下图: 2.安装环境与软件版本: Master: 所需软件:docker-ce 17.03.kubelet1.11.1.kubeadm1 ...

  7. 表达式目录树(Expression)

    一:什么是表达式树 Expression我们称为是表达式树,是一种数据结构体,用于存储需要计算,运算的一种结构,这种结构可以只是存储,而不进行运算.通常表达式目录树是配合Lambda一起来使用的,la ...

  8. javascript基础修炼(6)——前端路由的基本原理

    [造轮子]是笔者学习和理解一些较复杂的代码结构时的常用方法,它很慢,但是效果却胜过你读十几篇相关的文章.为已知的API方法自行编写实现,遇到自己无法复现的部分再有针对性地去查资料,最后当你再去学习官方 ...

  9. 易被忽略的Python内置类型

    Python中的内置类型是我们开发中最常见的,很多人都能熟练的使用它们. 然而有一些内置类型确实不那么常见的,或者说往往会被我们忽略,所以这次的主题就是带领大家重新认识这些"不同寻常&quo ...

  10. VisualStudio移动开发(C#、VB.NET)Smobiler开发平台——SliderView控件的使用方式

    SliderView控件 一.          样式一 我们要实现上图中的效果,需要如下的操作: 从工具栏上的“Smobiler Components”拖动一个SliderView控件到窗体界面上 ...