MySQL 5.7 and later versions prohibit the date of 0000-00-00 by default

I did data synchronization today and found that there were always errors, focusing on the default value of time. The mysql version of the data source is 5.5.30, and some time fields are set to 0000-00-00 00:00:00 by default. The target MySQL version is 5.7.17. According to the data, MySQL version 5.7 and above prohibits the date of 0000-00-00 by default.

Add the following settings in the [mysqld] area of ​​the MySQL configuration file. After restarting mysql, no error will be reported.

sql_mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325142788&siteId=291194637