Answer the question
In order to leave comments, you need to log in
How to allow zero dates in MariaDB?
You need to transfer a backup from one server to another.
But in the backup there are, for example, such constructions: `dt` timestamp DEFAULT NULL,
I.e. the default date field is NULL, and in new versions of MySQL this is prohibited
. On the Internet, it is suggested to write this to a file in /etc/mysql/conf.d/:
[mysqld]
sql_mode=IGNORE_SPACE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
show variables like 'sql_mode'
1067 - Invalid default value for 'dt'
Answer the question
In order to leave comments, you need to log in
Try it:
I think this is the case - you have `dt` by default 'NOT NULL'
Read about explicit_defaults_for_timestamp
explicit_defaults_for_timestamp is enabled, the server disables the nonstandard behaviors and handles TIMESTAMP columns as follows:
- It is not possible to assign a TIMESTAMP column a value of NULL to set it to the current timestamp. To assign the current timestamp, set the column to CURRENT_TIMESTAMP or a synonym such as NOW().
as I understand it, you can disable this option during import or replace it in the dump
with
** code not checked, taken from here
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question