mysql建表时如果有两个或以上的字段为Timestamp,那么可能会出现如下错误:

Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE

原因是当你给一个timestamp设置为on updatecurrent_timestamp的时候,其他的timestamp字段需要显式设定default值

但是如果你有两个timestamp字段,但是只把第一个设定为current_timestamp而第二个没有设定默认值,mysql也能成功建表,但是反过来就不行...

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
  • 2021-12-06
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2021-06-15
  • 2021-08-26
  • 2021-10-23
  • 2021-09-20
  • 2022-12-23
  • 2021-12-31
相关资源
相似解决方案