MySQL upgrades from 5.5 to 5.6, and changes in TIMESTAMP

Source: Internet
Author: User

MySQL upgrades from 5.5 to 5.6, and changes in TIMESTAMP
Preface

Some time ago, the system MySQL was upgraded from 5.5 to 5.6, and a large number of exceptions occurred. Most of the exceptions are caused by changes in TIMESTAMP behavior.

The behavior of TIMESTAMP in MySQL5.5 is the first implicit default value for the timestamp not null field with no default value set:
CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP is followed by the default value of timestamp not null. The default value is implicit:
0000-00-00 00:00:00 timestamp not null when the field is inserted NULL, the implicit default value is used:
CURRENT_TIMESTAMP does not support multiple CURRENT_TIMESTAMP default values TIMESTAMP actions in MySQL5.6 support multiple CURRENT_TIMESTAMP default values can be compatible with 5.5 behavior, supports implicit default values
Explicit_defaults_for_timestamp = 0 this parameter is used by default in MySQL5.6 I tested and installed. When started, the server will give a warning.
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details). You can remove the implicit DEFAULT value.
Explicit_defaults_for_timestamp = 1 sum up the TIMESTAMP behavior in MySQL5.5 is quite strange and may cause some implicit problems. For example, if the NULL value MySQL5.6 is input in the program, the TIMESTAMP behavior can be changed to normal, but there will be compatibility issues. The explicit_defaults_for_timestamp parameter will disappear in the future. We should not rely too much on database features. These features will cause constraints to applications.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.