mysql建表出现Timestamp错误

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

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

缘由是当你给一个timestamp设置为on updatecurrent_timestamp的时候,其余的timestamp字段须要显式设定default值
spa

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

相关文章
相关标签/搜索