[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_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文件。
将远端数据库的数据传输到本地时候出现了这样的错误

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值