原语句:
alter table `test_table` add column time bigint COMMENT '时间' default UNIX_TIMESTAMP(now());
问题:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server time for the right syntax to use near 'unix_timestamp(now())' at line 1
解决:
原因不是网上说的不能数值型时间变量,不能够在默认值里面写函数体,应该是没有办法识别UNIX_TIMESTAMP(now())为一个整体吧,直接加个括号在外面就可以执行了。
alter table `test_table` add column time bigint COMMENT '时间' default (UNIX_TIMESTAMP(now()));