当前位置:网站首页>Timestamp with implicit default value is deprecated error in MySQL 5.6
Timestamp with implicit default value is deprecated error in MySQL 5.6
2022-07-06 10:38:00 【wx5caecf2ed0645】
install MySQL when , Yes warning:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
The reason is from 5.6 Start ,timestamp The default behavior of is already deprecated 了 .
stay MySQL 5.6.6 Before ,TIMESTAMP Default behavior of :
•TIMESTAMP Column if not explicitly stated NULL attribute , The default is NOT NULL.( And other data types , If not, declare as NOT NULL, allows NULL value .) Set up TIMESTAMP The column value of is NULL, Will be automatically stored as the current timestamp.
• The first one in the list TIMESTAMP Column , If there is no statement NULL attribute 、DEFAULT perhaps ON UPDATE, It will be assigned automatically DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP attribute .
• The second in the table TIMESTAMP Column , If not stated as NULL perhaps DEFAULT Clause , Automatically assigned by default '0000-00-00 00:00:00′. The value of the column is not specified when the row is inserted , This column is assigned by default '0000-00-00 00:00:00′, And there's no warning .
To turn off the warning , The following parameters need to be added :
?
1 2 | |
restart MySQL Then the error disappears , At this time TIMESTAMP Their behavior is as follows :
•TIMESTAMP If no statement is displayed NOT NULL, Is allowed NULL It's worth it , You can directly set it to NULL, There is no default fill behavior .
•TIMESTAMP No default assignment DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP attribute .
• Declare as NOT NULL And there is no default clause TIMESTAMP Columns have no default values . Insert columns into the data table , I didn't give it to TIMESTAMP When a column is assigned a value , If it's strict SQL Pattern , Will throw out a A mistake , If strictly SQL Mode is not enabled , The column is assigned to '0000-00-00 00:00:00′, There's also a warning .( This sum MySQL It's the same with other time types of data , Such as DATETIME)
( See : //www.jb51.net/article/71054.htm)
That is to say explicit_defaults_for_timestamp Shut down the timestamp Type field locks have some strange default behavior , After adding this parameter , If you still need to help timestamp Type specifies the default behavior , Then you need to display the specification displayed when creating the table .explicit_defaults_for_timestamp That's what it means : The display specifies that the default value is timestamp Type field .
边栏推荐
- 第一篇博客
- Mysql27 - Optimisation des index et des requêtes
- In fact, the implementation of current limiting is not complicated
- [Julia] exit notes - Serial
- MySQL23-存儲引擎
- [paper reading notes] - cryptographic analysis of short RSA secret exponents
- 15 medical registration system_ [appointment registration]
- MySQL combat optimization expert 09 production experience: how to deploy a monitoring system for a database in a production environment?
- MySQL21-用户与权限管理
- Pytoch LSTM implementation process (visual version)
猜你喜欢

Solve the problem of remote connection to MySQL under Linux in Windows

Mysql33 multi version concurrency control

MySQL34-其他数据库日志

实现微信公众号H5消息推送的超级详细步骤

MySQL transaction log

A necessary soft skill for Software Test Engineers: structured thinking
![15 medical registration system_ [appointment registration]](/img/c1/27c7a5aae82783535e5467583bb176.png)
15 medical registration system_ [appointment registration]

Emotional classification of 1.6 million comments on LSTM based on pytoch

MySQL31-MySQL事务日志
![13 medical registration system_ [wechat login]](/img/c9/05ad1fc86e02cf51a37c9331938b0a.jpg)
13 medical registration system_ [wechat login]
随机推荐
Windchill配置远程Oracle数据库连接
Solution to the problem of cross domain inaccessibility of Chrome browser
[paper reading notes] - cryptographic analysis of short RSA secret exponents
MySQL storage engine
MySQL實戰優化高手04 借著更新語句在InnoDB存儲引擎中的執行流程,聊聊binlog是什麼?
16 medical registration system_ [order by appointment]
MySQL实战优化高手11 从数据的增删改开始讲起,回顾一下Buffer Pool在数据库里的地位
[after reading the series] how to realize app automation without programming (automatically start Kwai APP)
用于实时端到端文本识别的自适应Bezier曲线网络
MySQL combat optimization expert 04 uses the execution process of update statements in the InnoDB storage engine to talk about what binlog is?
MySQL27-索引优化与查询优化
API learning of OpenGL (2003) gl_ TEXTURE_ WRAP_ S GL_ TEXTURE_ WRAP_ T
First blog
[programmers' English growth path] English learning serial one (verb general tense)
MySQL learning diary (II)
Use xtrabackup for MySQL database physical backup
Use of dataset of pytorch
What is the difference between TCP and UDP?
Jar runs with error no main manifest attribute
MySQL实战优化高手07 生产经验:如何对生产环境中的数据库进行360度无死角压测?