Solving SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value

This probably occurs if you're STRICT_TRANS_TABLES is set in sql-mode in my.cnf

Disabling

To disable immediately, run:

    set sql_mode=NO_ENGINE_SUBSTITUTION; set global sql_mode=NO_ENGINE_SUBSTITUTION;

To disable forever, edit my.conf and change sql_mode

[mysqld]

sql_mode=NO_ENGINE_SUBSTITUTION

Checking it's disabled

Run:

mysql> SHOW VARIABLES LIKE 'sql_mode';

The value should read NO_ENGINE_SUBSTITUTION

+---------------+------------------------+
| Variable_name | Value                  |
+---------------+------------------------+
| sql_mode      | NO_ENGINE_SUBSTITUTION |
+---------------+------------------------+
1 row in set (0.00 sec)