错误描述

在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. Files的常用方法都有哪些?

    Files. exists():检测文件路径是否存在.Files. createFile():创建文件.Files. createDirectory():创建文件夹.Files. delete():删 ...

  2. jQuery--事件案例(鼠标提示)

    1.文字提示 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ww ...

  3. 去掉win10的命令行

    FluentTerminal 和xshell类似,多个终端在一个页面,比较舒服,可复制,可粘贴 界面: https://github.com/felixse/FluentTerminal 自己去git ...

  4. Java 中 WeakReference 与 SoftReference 的区别?

    虽然 WeakReference 与 SoftReference 都有利于提高 GC 和 内存的效率, 但是 WeakReference ,一旦失去最后一个强引用,就会被 GC 回收,而软引用 虽然不 ...

  5. 学习heartbeat-04 原理及部署

    1. Heartbeat介绍 1.1 Heartbeat作用 通过它可以将资源(IP及程序服务等资源)从一台故障计算机快速转移到另一台运转正常的机器继续提供服务,在实际生产应用场景中,heartbea ...

  6. 判断集合中存在String字符串 或 判断集合中不存在String字符串

    一.使用场景 用于集合中有多个相近的字符,无法使用包含判断 如: 这里如果我想判断以上集合中是否包含"信封件-DE"就会被"信封件-DE2"影响到 毕竟:&qu ...

  7. idea问题之"一个或多个listeners启动失败问题"

    org.apache.catalina.core.StandardContext.startInternal 一个或多个listeners启动失败,更多详细信息查看对应的容器日志文件之 "A ...

  8. 如何将Matlab中“模糊控制设计器”的隶属度函数导出图片(figure)

    如何将Matlab中"模糊控制设计器"的隶属度函数导出图片(figure)详情参考matlab官方帮助手册:plotmf()函数https://www.mathworks.com/ ...

  9. 微信小程序版博客——开发汇总总结(附源码)

    花了点时间陆陆续续,拼拼凑凑将我的小程序版博客搭建完了,这里做个简单的分享和总结. 整体效果 对于博客来说功能页面不是很多,且有些限制于后端服务(基于ghost博客提供的服务),相关样式可以参考截图或 ...

  10. 【promise| async/await】代码的控制力

    什么样的代码好控制? 结构 + 节奏 --- 什么鬼? 如何控制节奏? 具体例子看看怎么控制节奏?