How to solve the error problem of Mysql field type date and datetime setting 0000-00-00 default value
This article mainly shows you "how to solve the Mysql field type date, datetime setting 0000-00-00 default value error problem", the content is easy to understand, clear, hope to help you solve the doubt, the following let the editor lead you to study and learn "how to solve the Mysql field type date, datetime setting 0000-00-00 default value error problem" this article.
Solution:
1. Use the root login database command interface to execute
Select @ @ sql_mode
Return
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIONONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
2. Continue to execute
SET GLOBAL sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
Reason:
NO_ZERO_IN_DATE,NO_ZERO_DATE is the root cause that cannot be defaulted to '0000-00-0000: 00'.
NO_ZERO_IN_DATE: date and month are not allowed to be zero in strict mode
NO_ZERO_DATE: set this value, the mysql database does not allow the insertion of zero dates, and inserting zero dates throws an error instead of a warning.
The above is all the contents of this article entitled "how to solve the problem of Mysql field type date, datetime setting 0000-00-00 default value error". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!