Invalid default value for datetime

Hi, I’m trying to import some schemas into a new install, using MySQL Version 5.7.23

I’m aware that since v5.6, MySQL uses a strict policy on no zero dates. The issue is that when attempting to import the schema (using Sequel Pro) I’m receiving this error message on any lines that use a datetime:

Invalid default value for 'comment_date' (Replace ‘comment_date’ with any datetime column name.)

Here’s the example line in the query:

comment_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',

I could, in theory, change the dates to a valid date when creating the schema; however, that can potentially break some plugins. How can I, when using Local by Flywheel, get past this barrier to implement the schemas I need?

Thanks!

While this technically doesn’t answer the question, it is a workaround:

I ran SET SQL_MODE='ALLOW_INVALID_DATES'; in the database and was then able to execute the database schemas.

1 Like

Awesome! Thanks for following up with the solution.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.