Menu Close

Month: November 2016

Invalid datetime value in mysql 5.7

Mysql 5.7 added a validation on datetime so blank value or ‘0000-00-00 00:00:00’ are no more valid dates and it will give you an error if you try to edit/alter a column with this value from console, phpmyadmin or from your applications.
For avoid this issue, you should set every datatime column as NULLABLE, but if you have existing databases and existing applications it’s lots of work.
A workaround for this problem is edit “sql_mode” option in your code, like prestashop:
https://github.com/PrestaShop/PrestaShop/pull/4507/files

But, if you want that phpmyadmin continues to work fine, you have to edit mysql conf file and set sql_mode persistently.