批量导出指定表的建表语句

### 导出化建表语句
mysql -hDB_NAME -uUSERNAME -pPASSWORD -A -N DATABASE -e "
show create table table_name_01                                       ;
show create table table_name_02                                       ;

" > show_create_table

### 格式化建表语句
awk '{for (i=2;i<=NF;i++)printf("%s ", $i);print "\n;\n"}' show_create_table|sed "s#\\\n#\n#g" >show_create_table_fix

posted @ 2022-01-25 15:28  chenzechao  阅读(380)  评论(0编辑  收藏  举报