zoukankan      html  css  js  c++  java
  • [Warning] TIMESTAMP with implicit DEFAULT value is deprecated

    As indicated by the warning, to turn off the nonstandard behaviors, enable the new explicit_defaults_for_timestamp system variable at server startup. With this variable enabled, the server handles TIMESTAMP as follows instead:
    所显示的警告,关闭非标准的行为,使新的explicit_defaults_for_timestamp系统变量在服务器启动时启用了这个变量,服务器处理时间戳,如下所示:

    TIMESTAMP columns not explicitly declared as NOT NULL permit NULL values. Setting such a column to NULL sets it to NULL, not the current timestamp.
    时间戳列没有明确声明为not NULL允许NULL值。设置这样的列为NULL将它设置为NULL,并不是当前的时间戳。

    No TIMESTAMP column is assigned the DEFAULT CURRENT_TIMESTAMP or ON UPDATE CURRENT_TIMESTAMP attributes automatically. Those attributes must be explicitly specified.
    不会自动指定默认TIMESTAMP列 为CURRENT_TIMESTAMP或更新CURRENT_TIMESTAMP属性。这些属性必须显式地指定。

    TIMESTAMP columns declared as NOT NULL and without an explicit DEFAULT clause are treated as having no default value. For inserted rows that specify no explicit value for such a column, the result depends on the SQL mode. If strict SQL mode is enabled, an error occurs. If strict SQL mode is not enabled, the column is assigned the implicit default of '0000-00-00 00:00:00' and a warning occurs. This is similar to how MySQL treats other temporal types such as DATETIME.
    TIMESTAMP列声明为NOT NULL,没有一个明确的 DEFAULT 值被视为没有默认值。为插入的行指定没有显式值的列,结果取决于SQL模式。如果启用了SQL模式严格,出现一个错误。如果严格SQL模式未启用,列分配隐含默认值“0000-00-00,”和一个警告的发生。这类似于MySQL如何对待其他时态类型如DATETIME。


    修改 my.ini 
    [mysqld ]
    添加 explicit_defaults_for_timestamp=true




  • 相关阅读:
    第3章 管道符、重定向与环境变量
    基于Linux命令行KVM虚拟机的安装配置与基本使用
    Linux系统真正的优势以及学习方法
    一款在线编写接口文档的工具
    springboot前端传参date类型后台处理方式
    软件工程专业需要知道的缩写和专业名词
    七牛云图床及MPIC工具使用
    阿里云ECS云服务器CentOS部署个人网站
    【字】biang
    【车】打开车窗技巧
  • 原文地址:https://www.cnblogs.com/djinmusic/p/4174133.html
Copyright © 2011-2022 走看看