我们专注攀枝花网站设计 攀枝花网站制作 攀枝花网站建设
成都网站建设公司服务热线:400-028-6601

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

MySQL5.7慢查询日志时间与系统时间差8小时原因-创新互联

成都创新互联公司-专业网站定制、快速模板网站建设、高性价比志丹网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式志丹网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖志丹地区。费用合理售后完善,十多年实体公司更值得信赖。>在对慢查询进行查看的时候发现时间不对,正好与系统时间相差8个小时。 1、慢查询显示时间如下 # Time: 2020-01-10T06:42:24.940811Z 2、系统时间 $ date Fri Jan 10 14:42:31 CST 2020 3、查看数据库参数 mysql> show variables like 'log_timestamps'; +----------------+-------+ | Variable_name | Value | +----------------+-------+ | log_timestamps | UTC | +----------------+-------+ 1 row in set (0.00 sec) UTC大家都知道是世界统一时间,而我现在的系统时间是东八区,比UTC早了8个小时,这就对上了。查看官方文档看一下官网的解释。 log_timestamps Property Value Command-Line Format --log-timestamps=# Introduced 5.7.2 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> 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 | +----------------+--------+
当前题目:MySQL5.7慢查询日志时间与系统时间差8小时原因-创新互联
URL标题:http://shouzuofang.com/article/pcggh.html

其他资讯