Home >Database >Mysql Tutorial >Why Does MySQL Throw 'Incorrect Date Value: '0000-00-00'' After an Upgrade and How Can I Fix It?
Explanation:
The error "Incorrect date value: '0000-00-00'" occurs when attempting to insert a date value of '0000-00-00' into a date column. This error has arisen after a recent MySQL upgrade.
Cause:
The issue is related to SQL mode, specifically strict mode. Strict mode has become more stringent with the advent of MySQL 5.7, disallowing the insertion of invalid date values such as '0000-00-00'.
Solution:
To resolve the error, strict mode can be disabled by executing the following query:
SET GLOBAL sql_mode = '';
This action deactivates strict mode and allows the insertion of the '0000-00-00' date value.
Additional Notes:
The above is the detailed content of Why Does MySQL Throw 'Incorrect Date Value: '0000-00-00'' After an Upgrade and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!