MySQL [Warning] TIMESTAMP with implicit DEFAULT value is deprecated

Posted 超凡脫俗

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL [Warning] TIMESTAMP with implicit DEFAULT value is deprecated相关的知识,希望对你有一定的参考价值。

[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[Warning] 'ERROR_FOR_DIVISION_BY_ZERO' is deprecated and will be removed in a future release.
[Warning] 'NO_ZERO_DATE' is deprecated and will be removed in a future release.
[Warning] 'NO_ZERO_IN_DATE' is deprecated and will be removed in a future release.

TIMESTAMP with implicit DEFAULT value is deprecated.
mysql配置文件my.ini或者my.cnf中的[mysqld]段落中添加一行
explicit_defaults_for_timestamp=true
如果在MySQL配置文件中指定了sql_mode并且使用了ERROR_FOR_DIVISION_BY_ZERO, NO_ZERO_DATE,NO_ZERO_IN_DATE三者中的一个以上,则分别会报出已经不建议使用,以前将移除的错误信息。解决问题的方法,就是将他们全部从sql_mode中去掉。

sql_mode=“ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES”

以上是关于MySQL [Warning] TIMESTAMP with implicit DEFAULT value is deprecated的主要内容,如果未能解决你的问题,请参考以下文章

MySQL timestamp NOT NULL插入NULL的问题

MySQL中timestamp数据类型定义

MySQL中timestamp数据类型定义

mysql 数据类型TIMESTAMP

MySQL TIMESTAMP 为默认 NULL,而不是 CURRENT_TIMESTAMP

MySQL探究之TIMESTAMP