错误描述

在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. Java 中 IO 流分为几种?

    按功能来分:输入流(input).输出流(output).按类型来分:字节流和字符流.字节流和字符流的区别是:字节流按 8 位传输以字节为单位输入输出数据,字符流按 16 位传输以字符为单位输入输出数 ...

  2. @Qualifier 注解有什么用?

    当您创建多个相同类型的 bean 并希望仅使用属性装配其中一个 bean 时,您可 以使用@Qualifier 注解和 @Autowired 通过指定应该装配哪个确切的 bean 来消除歧义. 例如, ...

  3. memcached 能接受的 key 的最大长度是多少?

    key 的最大长度是 250 个字符.需要注意的是,250 是 memcached 服务器端内 部的限制,如果您使用的客户端支持"key 的前缀"或类似特性,那么 key(前缀 + ...

  4. 转载:STL四种智能指针

    转载至:https://blog.csdn.net/K346K346/article/details/81478223 STL一共给我们提供了四种智能指针: auto_ptr.unique_ptr.s ...

  5. SpringAOP+RabbitMQ+WebSocket实战

    背景 最近公司的客户要求,分配给员工的任务除了有微信通知外,还希望PC端的网页也能实时收到通知.管理员分配任务是在我们的系统A,而员工接受任务是在系统B.两个系统都是现在已投入使用的系统. 技术选型 ...

  6. Spring与Web项目整合的原理

    引言: 在刚开始我们接触IOC时,我们加载并启用SpringIOC是通过如下代码手动加载 applicationContext.xml 文件,new出context对象,完成Bean的创建和属性的注入 ...

  7. PID控制算法的C语言实现

    参考: PID控制器开发笔 浅谈位置式PID 专家PID控制在快速系统中的仿真及应用(这篇了论文介绍的积分分离PID.专家PID(脚本实现和simulink实现)很详细) PID控制算法的C语言实现一 ...

  8. 【动态系统的建模与分析】8_频率响应_详细数学推导 G(jw)_滤波器

  9. 8_根轨迹_Part2_根轨迹手绘技巧

    传递函数分母部分相同

  10. 2022首场MASA技术团队黑客松赛事大赛完美落幕!精彩集锦

    Masa技术团队在2021年创立,这一年我们团队发布了我们第一个产品,Masa Blazor.登上了.NET Conf China,我们承诺,开源我们的产品,为开源社区增砖加瓦,一路上收获技术社区文章 ...