Answer the question
In order to leave comments, you need to log in
Why does this MySQL error occur?
here is a request
CREATE TABLE `main_documents` (
`id` int(11) NOT NULL,
`employee_id` int(11) DEFAULT NULL,
`citizenship_id` int(11) DEFAULT NULL,
`document_type_id` int(11) DEFAULT NULL,
`first_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`last_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`middle_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`birthday` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`hometown` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`issue_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`expiration_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`gender` int(11) DEFAULT NULL,
`series` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`number` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`scan_id` int(11) DEFAULT NULL,
`issued_by` text COLLATE utf8_unicode_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
#1067 - Invalid default value for 'issue_date'
Answer the question
In order to leave comments, you need to log in
timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'should be a timestamp, 0000-00-00 00:00:00 - this is not a timestamp
This is an invalid date that worked in older versions of Mysql due to a misunderstanding. In Mysql 8, this misunderstanding can be corrected with a special NO_ZERO_DATE flag , which you apparently have enabled.
And in 5.7 there was STRICT MODE .
Not to mention that your column is of type timestamp.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question