MySQL慢查询日志时间与系统不一致的解决方法
发表于:2024-10-23 作者:千家信息网编辑
千家信息网最后更新 2024年10月23日,如何解决MySQL慢查询日志时间与系统时间相差8小时?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。在对慢查询进行查看的时候发现时间不对,
千家信息网最后更新 2024年10月23日MySQL慢查询日志时间与系统不一致的解决方法
如何解决MySQL慢查询日志时间与系统时间相差8小时?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
在对慢查询进行查看的时候发现时间不对,正好与系统时间相差8个小时。1、慢查询显示时间如下# Time: 2020-01-10T06:42:24.940811Z2、系统时间$ dateFri Jan 10 14:42:31 CST 20203、查看数据库参数mysql> show variables like 'log_timestamps';+----------------+-------+| Variable_name | Value |+----------------+-------+| log_timestamps | UTC |+----------------+-------+1 row in set (0.00 sec)UTC大家都知道是世界统一时间,而我现在的系统时间是东八区,比UTC早了8个小时,这就对上了。查看官方文档看一下官网的解释。log_timestampsProperty ValueCommand-Line Format --log-timestamps=#Introduced 5.7.2System Variable log_timestampsScope GlobalDynamic YesType EnumerationDefault Value UTCValid Values UTCSYSTEMThis 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> SET GLOBAL log_timestamps = SYSTEM;Query OK, 0 rows affected (0.00 sec)mysql> SHOW GLOBAL VARIABLES LIKE 'log_timestamps';+----------------+--------+| Variable_name | Value |+----------------+--------+| log_timestamps | SYSTEM |+----------------+--------+
以上就是慢查询日志时间与系统不一致的解决方法,详细使用情况还需要大家自己亲自动手使用过才能领会。如果想了解更多相关内容,欢迎关注行业资讯频道!
时间
系统
查询
小时
问题
方法
日志
参数
一致
不对
束手无策
为此
世界
亲自动手
内容
原因
官方
对此
就是
情况
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
四种常见的数据库系统模型
专科生计算机网络技术和建筑工程技术哪个好
服务器播放m3u8
网络安全调研表模板
网络安全法专题研讨
哈尔滨共筑网络安全防线
大型数据库嵌入式系统
城口it网络技术培训招生
服务器配什么网卡好
77读书软件开发
宁波鄞州附近戴尔机架式服务器
梦幻服战第一服务器
湛江安卓软件开发哪家好
服务器添加iis
桂林市app软件开发多少钱
日立uax服务器连接通讯超时
基础设施及代码管理服务器
金融科技行业周报中国互联网
用什么服务器建网站快
linux上达梦数据库日志
使用与管理服务器
智能机械软件开发
联通软件开发工程师的待遇
知道域名怎么查服务器所在地
新零售和网络安全
服务器安装软件拒绝访问
腾鸿广州互联网科技
软件开发企业没有进项
数据库查询某个时间点
水城软件开发有限公司