MySQL 2038年自动关闭问题

1. 问题描述

如果时间来到了 2038 年,或者手动将操作系统的本地时间调整为 2038 年,比如 2038-12-12,你会发现正在运行的 MySQL 会自动关闭,重启后同样会自动关闭,无法使用,查看错误日志,会有下面的一段错误信息,MySQL 不支持 2038 年之后的日期。

This MySQL server doesn't support dates later then 2038

2038-12-12T12:12:15.989231+08:00 7 [Warning] Current time has got past year 2038. Validating current time with 5 iterations before initiating the normal server shutdown process. 2038-12-12T12:12:15.989298+08:00 7 [Warning] Iteration 1: Current time obtained from system is greater than 2038 2038-12-12T12:12:15.989313+08:00 7 [Warning] Iteration 2: Current time obtained from system is greater than 2038 2038-12-12T12:12:15.989320+08:00 7 [Warning] Iteration 3: Current time obtained from system is greater than 2038 2038-12-12T12:12:15.989326+08:00 7 [Warning] Iteration 4: Current time obtained from system is greater than 2038 2038-12-12T12:12:15.989332+08:00 7 [Warning] Iteration 5: Current time obtained from system is greater than 2038 2038-12-12T12:12:15.989338+08:00 7 [ERROR] This MySQL server doesn't support dates later then 2038