MySQL Incorrect datetime value: '0000-00-00 00:00:00'

后端 未结 19 1011
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 15:51

I\'ve recently taken over an old project that was created 10 years ago. It uses MySQL 5.1.

Among other things, I need to change the default character set from latin1

19条回答
  •  执笔经年
    2020-11-29 16:43

    You can change the type of created field from datetime to varchar(255), then you can set (update) all records that have the value "0000-00-00 00:00:00" to NULL.

    Now, you can do your queries without error. After you finished, you can alter the type of the field created to datetime.

提交回复
热议问题