Skip to content

Instantly share code, notes, and snippets.

@dalethedeveloper
Created December 16, 2016 14:09
Show Gist options
  • Save dalethedeveloper/98fc081210ed1ba2f364d0079620d734 to your computer and use it in GitHub Desktop.
Save dalethedeveloper/98fc081210ed1ba2f364d0079620d734 to your computer and use it in GitHub Desktop.
Extract a single WP Multisite Side DB Files
#!/bin/bash
WPUSER="username"
WPDBNAME="wp_db"
if [ $# -ne 1 ]
then
echo "Enter a WPMU ID for the Database"
exit
fi
DBS=$(mysql -u $WPUSER -p -ss $WPDBNAME -e "SHOW TABLES LIKE 'wp_$1_%'" | tr "\n" " ")
$(mysqldump -u $WPUSER -p $WPDBNAME $DBS > wp_$1_sql)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment