mysqldump entire structure but only data from selected tables in a single command

前端 未结 5 610
感情败类
感情败类 2021-01-30 05:39

My database has 3 tables: table1, table2 and table3

I would like to do a mysqldump on this database with the following conditions:

  • Dump structure for all t
5条回答
  •  离开以前
    2021-01-30 06:05

    You can remove the INSERT INTO ... part:

    mysqldump \
      --opt \
      -u ${DB_USER} -p${DB_PASS} \
      ${DB_NAME} \
      | grep -v 'INSERT INTO `table3`' \
      | grep -v 'INSERT INTO `table4`'
    

提交回复
热议问题