Skip to content

Instantly share code, notes, and snippets.

@tofirius
Last active January 16, 2023 19:56
Show Gist options
  • Save tofirius/db6e061a60fe7cd4253bf9a555a0a9b2 to your computer and use it in GitHub Desktop.
Save tofirius/db6e061a60fe7cd4253bf9a555a0a9b2 to your computer and use it in GitHub Desktop.
MySQL dump of tables that begin with a given prefix
mysql database_name -u username -pPassWord -N -e 'show tables like "tableprefix\_%"' | xargs mysqldump database_name -u username -pPassWord > prefixedtable_dump.sql
@tofirius
Copy link
Author

tofirius commented May 3, 2016

This is particularly handy if you need to update only Wordpress tables within a database that is used for other purposes.

@jjack-vertex
Copy link

Thanks for this! Quick edit - second command should use -u instead of --u.

@tofirius
Copy link
Author

tofirius commented Dec 7, 2020

Thanks for this! Quick edit - second command should use -u instead of --u.

Thanks for the catch @jjack-vertex !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment