How to fix MySQL ERROR 1067 Invalid default value for date fix in phpmyadmin (Read Desc)

preview_player
Показать описание
How to fix MySQL ERROR 1067 (42000): Invalid default value for date field?

The problem might be of "sql_modes". You can check the current status by running
show variables like 'sql_mode' ;
To fix this issue you have to remove the
sql_mode "NO_ZERO_IN_DATE,NO_ZERO_DATE".

Solution 01:
set global sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
If above give any sql error please try solution 02 and recommended to save your previous sql_mode values.
Solution 02:
Before you run any statements put the following code in the first line
SET sql_mode = '';

Thank you.
Рекомендации по теме
Комментарии
Автор

if nothing is working try to open the import file with text editor and replace "current_timestamp()" with any date like "2024-07-28". It will work :D

punishtr
Автор

I get this error does anyone know how to fix it? # 1067 invalid default value for ' time '

evilknight
Автор

From MySQL 5.5 manual : "You cannot set the default for a date column to be the value of a function such as NOW() or CURRENT_DATE. The exception is that you can specify CURRENT_TIMESTAMP as the default for a TIMESTAMP column"

lepiredescas
welcome to shbcf.ru