Skip to content

Instantly share code, notes, and snippets.

@KensoDev
Created January 16, 2012 11:20
Show Gist options
  • Select an option

  • Save KensoDev/1620357 to your computer and use it in GitHub Desktop.

Select an option

Save KensoDev/1620357 to your computer and use it in GitHub Desktop.
all_tables=`mysql {database} -B -N --user={user} --password={password} --host={host} -e "SHOW TABLES;"`
exclude_tables=(table_names)
tables=`comm -2 -3 <(echo ${all_tables} | tr ' ' '\n' | sort) <(echo ${exclude_tables[*]} | tr ' ' '\n' | sort)`
mysqldump {database} ${tables} --user={user} --password={password} --host={host} --skip-lock-tables | gzip > production.sql.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment