Home  >  Q&A  >  body text

mysql新建字段时 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' 报错

天蓬老师天蓬老师2743 days ago865

reply all(4)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 15:01:41

    This default value is not allowed by default starting from 5.7. It is recommended to check the official website documentation.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:01:41

    It is recommended to use int to save time

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 15:01:41

    What is your timestamp field type?
    ps: In addition, it was mentioned above that the int format is not optimal in all scenarios

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 15:01:41

    Timestamp supports a limited year range, but occupies 2 bytes. Datetime can support 0000 to 9999, but occupies 4 bytes

    reply
    0
  • Cancelreply