#1067 – Invalid default value for ‘post_date’ or Anything [FIX]

You get this error probably because of the SQL mode which can be strict mode as per the latest MYSQL 5.7 documentation.

Strict mode affects whether the server permits ‘0000-00-00’ as a valid date: If strict mode is not enabled, ‘0000-00-00’ is permitted and inserts produce no warning. If strict mode is enabled, ‘0000-00-00’ is not permitted and inserts produce an error unless IGNORE is given as well. For INSERT IGNORE and UPDATE IGNORE, ‘0000-00-00’ is permitted and inserts produce a warning.

Solution

Run these queries:

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

SQL mode will change to default after MySQL restart. So i recommend you to backup the entire database after you alter the changes.

Leave a Comment