In MySQL version 5.7.11, users have encountered an issue while inserting values into a table with a date type column having a default value of '0000-00-00' using phpMyAdmin. The error reported is "Incorrect date value: '0000-00-00'".
Upon investigation, it was discovered that this error is caused by the SQL mode settings, specifically the inclusion of strict mode. In MySQL 5.7, stricter validation is enforced by default, including the rejection of '0000-00-00' as a valid date.
To resolve this issue, it is necessary to disable strict mode. This can be achieved by executing the following query:
SET GLOBAL sql_mode = '';
By running this query, strict mode will be temporarily disabled, allowing for the insertion of '0000-00-00' as a valid date without encountering the error.
For further comprehension of SQL mode settings, refer to the MySQL documentation. This issue has been reported and acknowledged by the MySQL team as a known behavior change introduced in version 5.7. Disabling strict mode is a common solution to resolve this particular problem.
The above is the detailed content of Why Does MySQL 5.7.11 Return 'Incorrect date value: '0000-00-00'' and How Can I Fix It?. For more information, please follow other related articles on the PHP Chinese website!