[Warning] TIMESTAMP with implicit DEFAULT value is deprecated.

html5cloud 2013-02-18 03:52:18
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
Please use --explicit_defaults_for_timestamp server option (see
documentation for more details).

请用中文说出怎样解决呢?

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:

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.

No TIMESTAMP column is assigned the DEFAULT CURRENT_TIMESTAMP or ON UPDATE CURRENT_TIMESTAMP attributes automatically. Those attributes must be explicitly specified.

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.
...全文
71458 17 打赏 收藏 举报
写回复
17 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
Alyces 2015-06-18
mysql.cnf这个文件在什么位置呢?
  • 打赏
  • 举报
回复
nicocnsdn999 2015-03-18
正如警告语说的,要关掉这种非标准行为,得在启动服务前开启系统变量explicit_defaults_for_timestamp! 如此,系统方能按如下的方式处理timestamp: timestamp榄没有显式声明为not null的将会允许null值。设置为null就会是null,而不是当前timestamp! 没有timestamp榄会被自动赋值为default current_timestamp或on update current_timestamp。而是要显式去赋值! timestamp榄声明为not null并且没有显式声明一个默认值将被认定为没有默认值。向这样的榄插入记录将完全看SQL模式的心情。如果是strict模式,就报错! 如果不是,将被赋值为'00-00-00 00:00:00'并给一个警告。处理DATETIME也是这样!
  • 打赏
  • 举报
回复
zhuifengzhifeng 2013-07-11
[mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. innodb_buffer_pool_size = 128M port = 3306 socket = MySQL key_buffer_size = 16K max_allowed_packet = 1M table_open_cache = 4 sort_buffer_size = 64K read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_length = 2K thread_stack = 128K server-id= 1 character-set-server=gbk default-storage-engine=INNODB #开启查询缓存 explicit_defaults_for_timestamp=true 添加后就不再显示错误了。
  • 打赏
  • 举报
回复
debug0x 2013-03-11
在my.ini mysqld 下添加 explicit_defaults_for_timestamp=true
  • 打赏
  • 举报
回复
rucypli 2013-02-19
直接在mysql.cnf里的mysqld下加一行explicit_defaults_for_timestamp
  • 打赏
  • 举报
回复
gjsword 2013-02-19
刚刚查了下 楼主可以用管理员权限打开cmd 之后进入目录后执行mysqld -install 我的就这么解决的
  • 打赏
  • 举报
回复
gjsword 2013-02-19
我也遇到同样的问题了 楼主解决了吗 ?
  • 打赏
  • 举报
回复
「已注销」 2013-02-19
引用 11 楼 html5cloud 的回复:
my.ini 添加: explicit_defaults_for_timestamp 搞不懂这句是怎么用的 :mysql_args="--explicit_defaults_for_timestamp"
还是在my.cnf加上边这一句.
  • 打赏
  • 举报
回复
「已注销」 2013-02-19
引用 11 楼 html5cloud 的回复:
my.ini 添加: explicit_defaults_for_timestamp 搞不懂这句是怎么用的 :mysql_args="--explicit_defaults_for_timestamp"
编译的时候吧.
  • 打赏
  • 举报
回复
html5cloud 2013-02-19
my.ini 添加: explicit_defaults_for_timestamp 搞不懂这句是怎么用的 :mysql_args="--explicit_defaults_for_timestamp"
  • 打赏
  • 举报
回复
html5cloud 2013-02-18
添加 代码: mysql_args="--explicit_defaults_for_timestamp" ---------------- 请问这句代码添加到哪里呢? my.ini 或者 php.ini
  • 打赏
  • 举报
回复
html5cloud 2013-02-18
刚刚网上找到这个的: 启动如果有这个警告 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option 添加 代码: mysql_args="--explicit_defaults_for_timestamp" 默认配置没开查询缓存哦亲~ 刚刚在测试服务器上升级完 /usr/local/share/mysql/有innodb_memcached_config.sql
  • 打赏
  • 举报
回复
ACMAIN_CHM 2013-02-18
检查你的 my.ini 中的参数文件中这个参数。
  • 打赏
  • 举报
回复
html5cloud 2013-02-18
然后出现 starting mysql... 接着出现 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 网上说: 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: 不懂: turn off the nonstandard behaviors?
  • 打赏
  • 举报
回复
html5cloud 2013-02-18
MySQL Server 5.6 echo starting mysql... "c:\server\MySQL\bin\mysqld" exit
  • 打赏
  • 举报
回复
WWWWA 2013-02-18
MYSQL什么版本,字段是是什么类型
  • 打赏
  • 举报
回复
相关推荐
发帖
MySQL
加入

5.6w+

社区成员

MySQL相关内容讨论专区
社区管理员
  • MySQL
申请成为版主
帖子事件
创建了帖子
2013-02-18 03:52
社区公告
暂无公告