Invalid Default Value for 'create_date' Timestamp Field
When creating a table with a timestamp column and specifying a default value of '0000-00-00 00:00:00', an error may occur indicating "Invalid default value for 'create_date'". This error is caused by MySQL's SQL Mode - NO_ZERO_DATE.
According to the MySQL reference manual, NO_ZERO_DATE prevents the insertion of '0000-00-00' as a valid date in strict mode. In this case, the 'create_date' column was defined as a timestamp and assigned a default value of '0000-00-00 00:00:00'. However, SQL Mode - NO_ZERO_DATE prohibits such values.
To resolve this error, consider the following options:
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3