MySQL – Error While Restoring Table Dump

MySQLmysql-5.5mysql-5.7mysqldumpUbuntu

ERROR 1067 (42000) at line 25: Invalid default value for 'created_on'

I'm getting this error while restoring a table after taking the dump(remotely). I have used

 mysqldump -h (hostname) -u -p (dbname) (tablename) > dump.sql 

and restored using

 mysql -u -p (dbname) < dump.sql.

Thank-you.

Best Answer

Please check your current sql_modes by command:

show variables like 'sql_mode' ; 

Or

You can include SET statement, before you run any statements put this in the first line:

SET sql_mode = '';

Problem might be because of sql_modes.

So change it by remove the sql_mode "NO_ZERO_IN_DATE,NO_ZERO_DATE" to make it work.

This is the default sql_mode in mysql new versions.