reprinted from Http://blog.csdn.net/ghsau. MySQL upgrade from 5.5 to 5.6,timestamp changesThe behavior of timestamp in MySQL5.5
- The first timestamp non-null character De Yin default value is not set by default:
Current_timestamp on UPDATE Current_timestamp
- The default value of the timestamp not NULL character De Yin is not set in the following format:
0000-00-00 00:00:00
- TIMESTAMP The NOT NULL field inserts NULL, an implicit default value is used:
Current_timestamp
- Multiple Current_timestamp default values are not supported
The behavior of timestamp in MySQL5.6
- Supports multiple current_timestamp default values
- Can be compatible with 5.5 behavior, supporting implicit default values
- Explicit_defaults_for_timestamp=0
- I test the installation of MySQL5.6 by default with this parameter, when started, the server will give a warning.
[Warning] TIMESTAMP with implicit the DEFAULT value is deprecated. Use–explicit_defaults_for_timestamp server option (see documentation for more details).
- Implicit default values can be removed
- Explicit_defaults_for_timestamp=1
Summarize
- Timestamp behavior in MySQL5.5 is more bizarre, causing some hidden problems, such as the passing of a null value in a program
- Timestamp behavior can be normal in MySQL5.6, but there is a compatibility issue
- Explicit_defaults_for_timestamp parameter will disappear in the future
- We do not rely too much on the characteristics of the database, which can cause the application to be constrained
MySQL upgrade from 5.5 to 5.6,timestamp changes