Interested in Linux and open source news? You can subscribe to my weekly newsletter, cron.weekly, and stay up-to-date on news in open source, cool new projects and useful tips tailored to linux sysadmins!

Taking a MySQL-dump with a wildcard on table names

Author: 4 Comments

Situation: you want to take a mysqldump with all table-names that match a particular pattern, but you don't want all the tables.

Here's how:

root@serv: ~$ mysqldump YOURDBNAME $(mysql -D YOURDBNAME -Bse "SHOW TABLES LIKE 'table_pattern_%'") > /tmp/database-dump.sql

You can modifity the SHOW TABLES LIKE query to include all the table names that you want.

  1. Posted by Alan
  2. Posted by Mike Baxter
    • Posted by Mike Baxter

Add Your Comment