1

I took a look at this possibly dupicated article, but still did not find the result that I am looking for. The answer to that question explained how things work, but did not provide how to actually solve this problem. There was a solution to MYSQL bench, but I am working with TERMINAL on MAC OX.

birthday date NOT NULL DEFAULT '0000-00-00'

Returns: ERROR 1067 (42000): Invalid default value for 'birthday'.

How do I fix this problem? Can someone provide the full syntax? I am working with terminal on MAC OX.

Your help is much appreciated!

Community
  • 1
  • 1
Gnahzllib
  • 91
  • 1
  • 12
  • `birthday date NOT NULL DEFAULT CURRENT_TIMESTAMP` – Blank May 25 '16 at 05:33
  • try this http://stackoverflow.com/questions/20461030/current-date-curdate-not-working-as-default-date-value – vijaykumar May 25 '16 at 05:42
  • 1
    The error is raised by mysql, it is irrelevant which client you use. The solution in the linked topic is not specific to mysql workbench either. If zero date is not allowed, then the solution is not to use a zero date as default. Choose something else. – Shadow May 25 '16 at 05:46
  • Possible duplicate of [Invalid default value for 'create\_date' timestamp field](http://stackoverflow.com/questions/9192027/invalid-default-value-for-create-date-timestamp-field) – Michael - sqlbot May 25 '16 at 10:18
  • Click the link in the accepted answer in the linked question. You need to configure your server's `SQL_MODE` to allow all-zeroes in the date. Better, though, would be to use `DEFAULT NULL` since `NULL` is the correct marker for an unset/undefined value. This is a change in the default behavior in MySQL 5.7. – Michael - sqlbot May 25 '16 at 10:22
  • @Michael-sqlbot Thank you so much.... – Gnahzllib May 25 '16 at 19:59

2 Answers2

2

The supported range for DATE is '1000-01-01' to '9999-12-31'.

andy
  • 21
  • 1
2

According to MySQL documentation (http://dev.mysql.com/doc/refman/5.7/en/datetime.html) the supported range is '1000-01-01' to '9999-12-31'

GeoChatz
  • 668
  • 3
  • 18