Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
错误描述
在DBeaver执行DDL语句时报错:SQL 错误 [1293] [HY000]: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
DDL语句如下:
CREATE TABLE `etl_conf_d` (
`jobName` varchar(128) NOT NULL,
`jobNo` int(11) DEFAULT NULL,
`jobDesc` varchar(128) DEFAULT NULL,
`validFlg` varchar(1) DEFAULT NULL,
`runFlg` varchar(1) DEFAULT NULL,
`runStartTimestamp` TIMESTAMP ,
`runEndTimestamp` TIMESTAMP,
`finalEndTimestamp` TIMESTAMP,
`queryMinute` int(11) NOT NULL DEFAULT 0,
`etlStartTimestamp` TIMESTAMP ,
`etlEndTimestamp` TIMESTAMP ,
`createUser` varchar(128) DEFAULT NULL,
`createTimestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`evtUser` varchar(128) DEFAULT NULL,
`evtTimestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`jobName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
解决过程
查阅发现是MySQL版本的问题。MySQL低版本不支持在一个表里面有两个TIMESTAMP类型。
检查MySQL版本:
C:\Users\xuqy>mysql -V
mysql Ver 8.0.22 for Win64 on x86_64 (MySQL Community Server - GPL)
高于5.5.x
,可以支持两个Timestamp。但是DBeaver测试连接时,显示我的MySQLServer
版本是5.5.28
。
检查后我发现,我本地8.0.22
版本的MySQL并没有安装成功,services中运行的还是5.5.28
的旧版本。但是不知道为什么我使用mysql -V
显示的是8.0.22
。
解决方法
- 重新安装
8.0.22
版本的MySQL; - 换DBeaver的连接,
8.x.x
版本的MySQL连接应该选择MySQL 8+
而不是MySQL
Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause的更多相关文章
- Mysql运行SQL文件 错误Incorrect table definition;there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
问题描述 想从服务器上DOWN下数据库.操作:先把数据库转存为SQL文件,然后在本地利用navicate运行SQL文件,出现错误信息: Incorrect table definition;there ...
- msyql同步的时候报错 : 错误代码: 1293 Incorrect table definition;there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
场景,两个不同服务器上的数据库,进行数据库同步 但是执行之后,提示报错 错误代码: 1293 Incorrect table definition; there can be only one TIM ...
- 1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
在数据库执行脚本文件时,执行到一半会遇到 这种问题: 出错处:2018-05-14 18:53:38 行号:712454 错误代码: 1293 - Incorrect table definitio ...
- mysql单表多timestamp报错#1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
一个表中出现多个timestamp并设置其中一个为current_timestamp的时候经常会遇到#1293 - Incorrect table definition; there can be o ...
- Mysql --- Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
我使用的5.5的mysql数据库会报这个错, 换成5.7的就可以了
- 解决,Incorrect table definition; there can be only one auto column and it must be defined as a key
今天在迁移项目时,操作数据库报错: Incorrect table definition; there can be only one auto column and it must be defin ...
- mysql:[Err] 1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
删除主键时,出错:[Err] 1075 - Incorrect table definition; there can be only one auto column and it must be d ...
- ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key
约束字段为自动增长,被约束的字段必须同时被key约束 没有设置成primary key 时,会报错. 加上primary key 则设置成功.
- Error Code: 1175.You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.
在MySQL Workbench里面使用SQL语句: delete from 表名 提示出错: Error Code: 1175.You are using safe update mode and ...
随机推荐
- 转载:mysql引擎innodb和MyIsam的区别
转载至:https://my.oschina.net/suyain/blog/1925807 Innodb引擎: 1.Innodb引擎提供了对数据库ACID事务的支持,并且实现了SQL标准的四种隔离级 ...
- 学习zabbix(一)
一.zabbix监控简介 server: 通过收集snmp和agent发送的数据,写入数据库(MySQL,ORACLE),再通过 php+apache 在 web 前端展示. agent:主机通过安装 ...
- Python - 数据存储与数据库简介
- STM32 中的 assert_param 函数
在学STM32的时候函数assert_param出现的几率非常大,上网搜索一下,网上一般解释断言机制,做为程序开发调试阶段时使用. 断言机制函数assert_param我们在分析库函数的时候,几乎每一 ...
- node-webkit文档翻译#package.json
title: node-webkit文档翻译#package.json date: 2013-12-07 21:38:25 tags: node-webkit 基本示例 { "main&qu ...
- WordPress 网站开发“微信小程序“实战(三)
本文是"WordPress 开发微信小程序"系列的第三篇,本文记录的是开发"DeveWork+"小程序1.2 版本的过程.建议先看完第一篇.第二篇再来阅读本文. ...
- 使用Canvas和JavaScript做一个画板
本文同步于个人博客:https://zhoushuo.me/blog/2018/03/11/drawing-borad/ 前些天学习了HTML5的<canvas>元素,今天就来实践一下,用 ...
- python-使用函数输出指定范围内Fibonacci数的个数
本题要求实现一个计算Fibonacci数的简单函数,并利用其实现另一个函数,输出两正整数m和n(0<m<n≤100000)之间的所有Fibonacci数的数目. 所谓Fibonacci数列 ...
- 【Android开发】监听图库数据库的变化
步骤一: 保存图片或者删除之前,初始化ContentObserver ScreenshotContentObserver mScreenObserver = new ScreenshotContent ...
- javascript,如何实现数据绑定
在三大框架 抢占前端开发技术领域的时代,基本每个框架都是实现了数据绑定, 今天我们来解密一下数据绑定的原理, 原理关乎一个很关键的东西,Object.prototype.__defineSetter和 ...