mysqldump 导出的是全库 alldb.sql 导入的时候可不可以只导其中的一个表
法1:perl extract_sql.pl -t mytable -r mydumpfile > mytable.sql
法2:cat test1db.sql | sed -n ‘/Table structure for table .test1./,/Table structure for table .test2./p’>/tmp/xxx.sql
法3:awk ‘/Table structure for table .test1./,/Table structure for table .test2./{print}’ test1db.sql
参考地址:
https://blog.tsheets.com/2008/business-help/extract-a-single-table-from-a-mysqldump-file