[Warning] TIMESTAMP with implicit DEFAULT value is deprecated.

 

在免安装版mysql安装过程中出现:
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details). 
解决办法:需要在my.ini 下添加

[mysqld]

explicit_defaults_for_timestamp=true

以管理员的身份运行mysqld install 提示安装成功 
启动mysql: net start mysql 启动mysql服务,为了以后开发方便可以设置自动启动。win+R 运行services.msc 设置即可。 
配置环境变量:mysql_home/bin 
运行mysql:mysql -u root -p 密码,默认为空

my.ini可能在mysql的安装目录下本来就不存在,需要自己建立

 

[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

其原因是从 5.6开始,timestamp 的默认行为已经是 deprecated 了。

在MySQL 5.6.6之前,TIMESTAMP的默认行为:

•TIMESTAMP列如果没有明确声明NULL属性,默认为NOT NULL。(而其他数据类型,如果没有显示声明为NOT NULL,则允许NULL值。)设置TIMESTAMP的列值为NULL,会自动存储为当前timestamp。
•表中的第一个TIMESTAMP列,如果没有声明NULL属性、DEFAULT或者 ON UPDATE,会自动分配 DEFAULT CURRENT_TIMESTAMP和ON UPDATE CURRENT_TIMESTAMP 属性。
•表中第二个TIMESTAMP列,如果没有声明为NULL或者DEFAULT子句,默认自动分配'0000-00-00 00:00:00′。插入行时没有指明改列的值,该列默认分配'0000-00-00 00:00:00′,且没有警告。

要关闭警告,需要加入下面的参数:

1
2
[mysqld]
explicit_defaults_for_timestamp=true

重启MySQL后错误消失,这时TIMESTAMP的行为如下:

•TIMESTAMP如果没有显示声明NOT NULL,是允许NULL值的,可以直接设置改列为NULL,而没有默认填充行为。
•TIMESTAMP不会默认分配DEFAULT CURRENT_TIMESTAMP 和 ON UPDATE CURRENT_TIMESTAMP属性。
•声明为NOT NULL且没有默认子句的TIMESTAMP列是没有默认值的。往数据表中插入列,又没有给TIMESTAMP列赋值时,如果是严格SQL模式,会抛出一 个错误,如果严格SQL模式没有启用,该列会赋值为'0000-00-00 00:00:00′,同时出现一个警告。(这和MySQL处理其他时间类型数据一样,如DATETIME)
(参见://www.jb51.net/article/71054.htm

也就是 explicit_defaults_for_timestamp 关闭了 timestamp 类型字段锁拥有的一些会让人感到奇怪的默认行为,加入了该参数之后,如果还需要为 timestamp类型的字段指定默认行为,那么就需要显示的在创建表时显示的指定。explicit_defaults_for_timestamp 也就是这个意思:显示指定默认值为timestamp类型的字段。

https://www.jb51.net/article/71052.htm
 
https://blog.csdn.net/yanhenyiduo/article/details/68946937

MySQL 5.6.4 中TIMESTAMP with implicit DEFAULT value is deprecated 错误的更多相关文章

  1. Mysql报错[Warning] TIMESTAMP with implicit DEFAULT value is deprecated和Buffered warning: Changed limits

    报错2019-04-24 12:06:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use -- ...

  2. MYSQL TIMESTAMP with implicit DEFAULT value is deprecated.

    TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp se ...

  3. [Warning] TIMESTAMP with implicit DEFAULT value is deprecated

    启动mysql时,报如下警告信息: [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explic ...

  4. [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

    Linux下安装MySQL执行scripts/mysql_install_db --user=mysql脚本时,报错如下: Filling help tables...2019-12-24 16:46 ...

  5. [Warning] TIMESTAMP with implicit DEFAULT value is deprecated

    As indicated by the warning, to turn off the nonstandard behaviors, enable the new explicit_defaults ...

  6. MySQL错误:TIMESTAMP with implicit DEFAULT value is deprecated

    用于存放数据库的文件夹不为空,清空了再来一次!

  7. TIMESTAMP with implicit DEFAULT value is deprecated

    出错版本 mysql 5.7 why? (警告)不包含隐式默认值的时间戳 way? 在 /etc/my.conf中 mysqld 模块中添加 explicit_defaults_for_timesta ...

  8. TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option

    先解决他 详细不详解 在初始化 加上 --explicit_defaults_for_timestamp=true 即可

  9. mysql中timestamp的自动生成与更新

    转自:mysql中timestamp的自动生成与更新 MYSQL中TIMESTAMP类型可以设定默认值,就像其他类型一样.1.自动UPDATE 和INSERT 到当前的时间:表:----------- ...

随机推荐

  1. webpack+avalon+mmState打包方案

    终于到讲授如何整合avalon社区这个最强大的组件,基于状态机的路由系统了! 基于状态机的路由系统,据我所知,目前世界上只有三款,angular社区的ui-router, 网易出品的stateman, ...

  2. Android Studio 版本间区别

    2.3.2 ->3.0.1  Gradle版本为4.1   com.android.tools.build:gradle:3.0.x Android Monitor 被换成了 Android P ...

  3. Hibernate 再接触 集合映射

    不太重要 List 用于排序 Map  key一般是user的某个字段(多半是主键 integer) package com.bjsxt.hibernate; import java.util.Has ...

  4. C# WInForm中 窗体的this.width和this.height的属性值不能大于显示器的最大分辨率

    最近在做一个小项目的时候,发现在 1680x1050 分辨率显示器上写的代码,将窗体的宽度和高度 设置成了 1600×900,在高于1600×900的分辨率上缩放显示很正常, 而后转移到 分辨率低于 ...

  5. android listview中item通过viewpager实现《IT蓝豹》

    android listview中item通过viewpager实现 android listview中item通过viewpager实现,每一个item都支持viewpager实现图片切换功能.本项 ...

  6. struts2漏洞信息

    渗透篇01-struts2漏洞利用  https://blog.csdn.net/qq_38055050/article/details/79841604 Struts2著名RCE漏洞引发的十年之思  ...

  7. sse实例

    一.前台 <script>//D:\wamp\www\node\xiangmuer\views\main // var source = new EventSource('http://1 ...

  8. 解决python3.6的UnicodeEncodeError: 'gbk' codec can't encode character '\xbb' in position 28613: illegal multibyte sequence

    这是python3.6的print()函数自身有限制,不能完全打印所有的unicode字符. 主要的是windows下python的默认编码不是'utf-8',改一下python的默认编码成'utf- ...

  9. Realtime Rendering 6

    [Realtime Rendering 6] 1.Lighting computations occur in two phases: 1)light phase. used to compute t ...

  10. async.waterfall

    [async.waterfall] if any of the tasks pass an error to their own callback, the next function is not ...