Mysqldump ignore tables with certain prefix


i’m trying to backup some databases with mysqldump but i want to ignore some tables
with prefix phpbb_

i have tried many solution with Like a% wildcart , 'show tables … ’ notthing work
and no solution on google

any help from an expert ?

mysqldump -u username -pmypasswd database --ignore-table=database.table > database.sql

not an expert myself in SQL but found this that might help you

mysql databasename -u[username] -p[password] -e ‘show tables like “phpbb\_%”’ | grep -v Tables_in | xargs mysqldump [dbname] -u [username] -p[password] > [dump_file]

Suggest you back everything up before trying :wink:

thanx for your help but your solution don’t work because i want to use mysqldump with --ignore-table

From my limited knowledge I think thats what it does

mysql databasename -u[username] -p[password] -e 'show tables like "phpbb\%" | [B][I]Get list of all tables that start phpbb
[/I][/B]grep -v Tables_in | invert the match ie now select all tables that do not start phpbb_
xargs mysqldump [dbname] -u [username] -p[password] > [dump_file] Backup those tables

It actually does the opposite. I just tried it. It only dumps the tables with the prefix, rather than ignoring them.