如何对线上环境做表备份

1.在线上创建一个与需备份相同表结构的表

create table table_name_temp as select * from table_name where 1=2;  

2.在线上创建一个与需备份表数据相同的表

create table table_name_temp as select * from table_name ;  ---注意并不会创建索引

 3.把备份表的数据写回到原始表

insert into table_name select * from table_name_temp;

 

enjoy;

posted @ 2017-10-14 10:12  bigdog  阅读(328)  评论(0)    收藏  举报