Created
January 4, 2016 10:16
-
-
Save metaodi/3dc73226e40bef9ad650 to your computer and use it in GitHub Desktop.
DB dump of WordPress
This file contains 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
# create a new DB dump | |
mysqldump -u USERNAME -p --skip-extended-insert --skip-quick DB_NAME > dump.sql | |
# replace the domain name in the dump, this is needed if you plan to use the dump on another domain | |
sed 's/www\.example\.com/stage.example.com/g' < dump.sql > updated_dump.sql | |
# optional: re-create the database | |
mysql -u root -e"show databases;" | grep DB_NAME && mysql -u root -e"drop database DB_NAME;" | |
mysql -u root -e"create database DB_NAME;" | |
# apply the dump | |
mysql -u USERNAME DB_NAME < dump.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment