mysql5.5.23 CURRENT_TIMESTAMP问题
来源:互联网 发布:人群画像 淘宝 编辑:程序博客网 时间:2024/05/16 10:52
今天新建一个表,里面两个字段:创建时间和更新时间,两个默认值都是当前时间,一执行sql就报错。
ERROR 1293 (HY000): Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
我在其它的项目里面都是这样用的sql,而且也能正常用,为什么今天执行不成功呢?在确认sql没有语法错误后,在网上查了一下资料。原来是mysql5.5在一个表内只支持一个时间字段使用CURRENT_TIMESTAMP和ON UPDATE CURRENT_TIMESTAMP。但是在5.6里面支持多个。原版说明:
It is not possible to have the current timestamp be the default value for one column and the auto-update value for another column.
解决办法:去掉创建时间默认值
查看mysql版本号用 status命令
0 0
- mysql5.5.23 CURRENT_TIMESTAMP问题
- current_timestamp
- mysql的两个CURRENT_TIMESTAMP问题
- mysql5.5不能同时设置两个字段为CURRENT_TIMESTAMP
- mysql单表多timestamp的current_timestamp设置问题
- `CREATION_DATE` datetime DEFAULT CURRENT_TIMESTAMP报错问题
- Mysql数据库的一个问题-----不能两个timestamp字段的默认值同时是CURRENT_TIMESTAMP
- 向mysql数据表中添加字段creat_time时,遇到关于CURRENT_TIMESTAMP的问题
- MySQL5中varchar 问题
- Mysql5数据库连接超时问题
- mysql5 插入乱码问题
- mysql5.6 1067问题
- mysql5.5安装 问题
- mysql5.5编码问题
- Mysql5.7安装问题
- MySQL5数据库连接超时问题
- Mysql5乱码问题
- mysql5.7版本问题
- OK6410 Qt4.7.1移植
- [IOS]动画编程总结
- studio 2.1下我的NDK
- android解决小米手机裁剪图片异常问题
- 乐观锁以及乐观锁的实现
- mysql5.5.23 CURRENT_TIMESTAMP问题
- angularjs 学习
- java导出excel2007
- Sublime Text 3 激活 License
- imnoise, imnoise2 & imnoise3
- 一些快速提高Android开发的脚本与技巧(终端篇)
- centos安装pptp vpn
- hdu 1025
- fseek() ,fseeko(),fseeko64()讲解