Mysqldump only tables with certain prefix / Mysqldump wildcards?

后端 未结 9 2537
一个人的身影
一个人的身影 2020-12-07 07:37

I have this huge, messy database I am cleaning up. It houses 500+ tables, which is the result of combining Magento Enterprise with Joomla in one single DB.

To make t

9条回答
  •  青春惊慌失措
    2020-12-07 08:24

    There are already a lot of good answers, but I came here with such variation:

    mysql MY_DATABASE -N -u MY_MYSQLUSER -p -e 'show tables like "%MY_LIKE_CODE%";' |
    xargs mysqldump MY_DATABASE -u MY_MYSQLUSER -p |
    gzip > ~/backup/`date +%Y%m%d:::%H:%M:%S-MY_DAMP.sql.gz`
    

    By this action I made a table dump by the mask like %mask% from the database to a single file. Hopefully someone will find it useful.

提交回复
热议问题