mysql备份表sql
#不一定使用所有的表结构,但是可以参考
set @sql_create_table = concat('create table ', date_format(now(), 'BK%y%m%d_lnad_rou_audit_info '), 'like lnad_rou_audit_info;');
PREPARE sql_create_table FROM @sql_create_table;
execute sql_create_table;
set @sql_backup_table = concat('insert into ',date_format(now(), 'BK%y%m%d_lnad_rou_audit_info '),' select * from lnad_rou_audit_info');
PREPARE sql_backup_table FROM @sql_backup_table;
execute sql_backup_table;
set @sql_create_table:=NULL;
set @sql_backup_table:=NULL;
一切技术都是为业务服务,脱离业务的技术一文不值!