# Invalid default value for datetime

**URL:** <https://community.localwp.com/t/invalid-default-value-for-datetime/16329>\
**Category:** Support\
**Created:** [January 6, 2020, 7:13pm UTC](https://community.localwp.com/t/invalid-default-value-for-datetime/16329 "2020-01-06T19:13:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![OctoSponge](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/octosponge/32/9231_2.png) [@OctoSponge](https://community.localwp.com/u/OctoSponge)\
**Post date:** [January 6, 2020, 7:13pm UTC](https://community.localwp.com/t/invalid-default-value-for-datetime/16329/1 "2020-01-06T19:13:45Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![OctoSponge](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/octosponge/32/9231_2.png) [@OctoSponge](https://community.localwp.com/u/OctoSponge)\
**Post date:** [January 6, 2020, 10:34pm UTC](https://community.localwp.com/t/invalid-default-value-for-datetime/16329/2 "2020-01-06T22:34:00Z")

</div>

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

> <https://stackoverflow.com/questions/9192027/invalid-default-value-for-create-date-timestamp-field>

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

---

<div class="post-metadata">

**Author:** ![clay](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/clay/32/8248_2.png) [@clay](https://community.localwp.com/u/clay)\
**Post date:** [January 10, 2020, 4:48pm UTC](https://community.localwp.com/t/invalid-default-value-for-datetime/16329/3 "2020-01-10T16:48:21Z")

</div>

Awesome! Thanks for following up with the solution.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)\
**Post date:** [January 11, 2020, 4:48am UTC](https://community.localwp.com/t/invalid-default-value-for-datetime/16329/4 "2020-01-11T04:48:22Z")

</div>

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