[Err] [Dtf] 1293 – Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_T

梦想不抛弃苦心追求的人,只要不停止追求,你们会沐浴在梦想的光辉之中。再美好的梦想与目标,再完美的计划和方案,如果不能尽快在行动中落实,最终只能是纸上谈兵,空想一番。只要瞄准了大方向,坚持不懈地做下去,才能够扫除挡在梦想前面的障碍,实现美好的人生蓝图。[Err] [Dtf] 1293 – Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_T,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com,来源:原文

将远端数据库的数据传输到本地时候出现了这样的错误
[Err] [Dtf] 1293 – Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

在这里插入图片描述
发生错误的表:

 create table 'order_master' (    
'order_id' varchar(32) not null,    
'buyer_name' varchar(32) not null comment '买家名字',    
'buyer_phone' varchar(32) not null comment '买家电话',    
'buyer_address' varchar(128) not null comment '买家地址',    
'buyer_openid' varchar(64) not null comment '买家微信openid',    
'order_amount' decimal(8,2) not null comment '订单总金额',    
'order_status' tinyint(3) not null default '0' comment '订单状态,默认0新订单'    
'pay_status' tinyint(3) not null default '0' comment '订单状态,默认0未支付'    
'create_time' timestamp not null default current_timestamp comment '创建时间',    
'update_time' timestamp not null default current_timestamp on update current_timestamp comment '修改时间',    
primary key ('order_id'),    
key 'idx_buyer_openid' ('buyer_openid') 
) comment '订单表';

查了相关资料才知道 MySql 5.5和MySql 5.6之后版本的区别:5.5 只能有一个Timestamp,将其中一列类型改为datetime类型就可以解决。
远端mysql版本为5.7.17
在这里插入图片描述
解决方案:

1、备份远程数据转存为sql文件,将其中一列类型Timestamp改为datetime,比如上述错误表改为:

 create table 'order_master' (    
'order_id' varchar(32) not null,    
'buyer_name' varchar(32) not null comment '买家名字',    
'buyer_phone' varchar(32) not null comment '买家电话',    
'buyer_address' varchar(128) not null comment '买家地址',    
'buyer_openid' varchar(64) not null comment '买家微信openid',    
'order_amount' decimal(8,2) not null comment '订单总金额',    
'order_status' tinyint(3) not null default '0' comment '订单状态,默认0新订单'    
'pay_status' tinyint(3) not null default '0' comment '订单状态,默认0未支付'    
'create_time' datetime not null comment '创建时间',    
'update_time' timestamp not null default current_timestamp on update current_timestamp comment '修改时间',    
primary key ('order_id'),    
key 'idx_buyer_openid' ('buyer_openid') 
) comment '订单表';

2、本地数据库加载修改后的sql文件。
将远端数据库的数据传输到本地时候出现了这样的错误

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/150495.html

(0)
飞熊的头像飞熊bm

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!