MySQL Variables log_timestamps 数据库 参数变量解释及正确配置使用

本站中文解释

log_timestamps 这个参数控制着 MySQL 服务器事件类型的日志记录格式,可以设为时间戳或 DEFAULT 格式,默认值是 DEFAULT 。时间戳格式可以比较容易定位事件发生时间,而 DEFAULT 格式可以显示更多的详细信息。

要设置 log_timestamps ,登录 MySQL 后依次执行以下 MySQL 命令即可:

1. 查询当前 log_timestamps 的值:SHOW VARIABLES LIKE ‘log_timestamps’;

2. 修改 log_timestamps 的值:SET GLOBAL log_timestamps = ‘SYSTEM’;

3. 查询效果:SHOW VARIABLES LIKE ‘log_timestamps’;

官方英文解释

log_timestamps

Command-Line Format --log-timestamps=#
System Variable log_timestamps
Scope Global
Dynamic Yes
Type Enumeration
Default Value UTC
Valid Values

UTC

SYSTEM

This variable controls the time zone of timestamps in messages
written to the error log, and in general query log and slow
query log messages written to files. It does not affect the
time zone of general query log and slow query log messages
written to tables (mysql.general_log,
mysql.slow_log). Rows retrieved from those
tables can be converted from the local system time zone to any
desired time zone with
CONVERT_TZ() or by setting the
session time_zone system
variable.

Permitted log_timestamps
values are UTC (the default) and
SYSTEM (local system time zone).

Timestamps are written using ISO 8601 / RFC 3339 format:
YYYY-MM-DDThh:mm:ss.uuuuuu
plus a tail value of Z signifying Zulu time
(UTC) or ±hh:mm (an offset from
UTC).


数据运维技术 » MySQL Variables log_timestamps 数据库 参数变量解释及正确配置使用