mysql建表出现Timestamp错误

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也能成功建表,但是反过来就不行...

posted @ 2015-07-03 10:44  CIACs  阅读(1656)  评论(0编辑  收藏  举报