错误描述

在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

解决方法

  1. 重新安装8.0.22版本的MySQL;
  2. 换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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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的就可以了

  6. 解决,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 ...

  7. 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 ...

  8. 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 则设置成功.

  9. 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 ...

随机推荐

  1. 发现程序美----while+for冒泡实现的

    思想记录: 每一轮回的冒泡都将产生一个最大值,其后每次循环次数都将少一次,因为每次都会确定一个最大值. private void method(){ int[] list = {10,7,8,4,7, ...

  2. jvm-learning-双亲委派机制

    是什么 工作原理  例子 优势 什么是沙箱安全机制 其他知识 对类加载器的引用 类的主动使用和被动使用

  3. django中动态新建postgres数据库表

    import psycopg2def create_new_table(table_id): conn = psycopg2.connect(database='Test', user='postgr ...

  4. MariaDB 存储引擎一览(官方文档翻译)

    inline-translate.translate { } inline-translate.translate::before, inline-translate.translate::after ...

  5. XMLBeanFactory?

    最常用的就是org.springframework.beans.factory.xml.XmlBeanFactory ,它根据XML文件中的定义加载beans.该容器从XML 文件读取配置元数据并用它 ...

  6. Redis++:Redis做分布式锁真的靠谱吗

    Redis做分布式锁真的靠谱吗 Redis的分布式锁可以通过Lua进行实现,通过setnx和expire命令连用的方式 || 也可以使用高版本的方法同时设置失效时间,但是假如在以下情况下,就会造成无锁 ...

  7. Bootstrap 之 Metronic 模板的学习之路 - (1)总览

    写在前面 bootstrap 的模板非常多,Envato 上有着各种各样的免费及付费模板.Metronic 是我最喜欢的模板之一(看一眼就喜欢上的那种),当前售价 $28 ,觉得赞的,不妨支持一下作者 ...

  8. nodejs 实现 磁力链接资源搜索 BT磁力链接爬虫

    项目简介 前端站点 项目效果预览 http://findcl.com 使用 nodejs 实现磁力链接爬虫 磁力链接解析成 torrent种子信息,保存到数据库,利用 Elasticsearch 实现 ...

  9. ES6-11学习笔记--Generator

    基本使用 function后面加个*号 function* foo() { for (let i = 0; i < 3; i++) { yield i; // yield不能作为构造函数去使用, ...

  10. CentOS系统Tomcat 8.5或9部署SSL证书

    本文档介绍了CentOS系统下Tomcat 8.5或9部署SSL证书的操作说明. 环境准备 操作系统:CentOS 7.6 64位 Web服务器:Tomcat 8.5或9 前提条件 已从阿里云SSL证 ...