[Warning] TIMESTAMP with implicit DEFAULT value is deprecated.

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介:

    其实这个报错在安装的初始化的时候就已经有了(在第一篇安装的文章中能看到),只不过没有影响安装和启动,所以并没有管,以为只是安装的时候检查类的报错,后来在重启mysql发现在error日志里面也会出现这个报错


解决方法:

在mysql官方网站上找到这么一段话

Those nonstandard behaviors remain the default for TIMESTAMP but as of MySQL 5.6.6 are deprecated and this warning appears at startup:


[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:


这段话的意思是在5.6以后有这么一项检查,所以要开启标准的 explicit_defaults_for_timestamp功能,但是默认是关闭的。


在my.cnf中加入

[mysqld]

explicit_defaults_for_timestamp=true


如果还是报错,按mysql提示的执行下面的mysql启动命令:

./bin/mysqld_safe --user=mysql --explicit_defaults_for_timestamp=1 &





本文转自 yuri_cto 51CTO博客,原文链接:http://blog.51cto.com/laobaiv1/1951798,如需转载请自行联系原作者

相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
打赏
0
0
0
0
265
分享
相关文章
As the default settings are now deprecated, you should set the endpoint inste
As the default settings are now deprecated, you should set the endpoint inste
|
9月前
|
【Python】已解决:FutureWarning: The default value of regex will change from True to False in a future ver
【Python】已解决:FutureWarning: The default value of regex will change from True to False in a future ver
263 1
Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT
Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT
Automysqlbackup: WARNING: Turning off multicore support, since pigz isn’t there.
在使用Automysqlbackup备份MySQL时,有时候你会在邮件里面看见"WARNING: Turning off multicore support, since pigz isn't there."这样的告警信息,为什么会出现这个告警信息呢? 错误原因: Automysqlbackup在备份MySQL数据库时会去压缩dump文件。
1153 0
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等