Created
September 18, 2019 01:25
-
-
Save mjtiempo/d40d51a09977428954297262c181b8d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#read db credentials from wp-config.php | |
source <(php -r 'require("wp-config.php"); echo("DB_NAME=".DB_NAME."; DB_USER=".DB_USER."; DB_PASSWORD=".DB_PASSWORD."; TABLE_PREFIX=".$table_prefix); ') | |
#dump wp db on wpdb_backup_$DB_NAME.sql | |
mysqldump --user $DB_USER --password="$DB_PASSWORD" $DB_NAME > wpdb_backup_$DB_NAME.sql | |
#find and replace $table_prefix | |
sed -i 's/$TABLE_PREFIX/wp_/g' wpdb_backup_$DB_NAME.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment