Created
August 9, 2019 11:09
-
-
Save mklasen/096979b37d300b16202e75da0351f8dd to your computer and use it in GitHub Desktop.
Migrate a database from local to staging/production with WP CLI and SSH
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
## | |
# This assumes the following folder structure | |
# Local environment: | |
# ./app/ | |
# ./app/www/ | |
# ./_db_dumps/ | |
# | |
# Production/staging environment: | |
# ./wordpress/current/ | |
# ./_db_dumps/ | |
### | |
# Local, in: ./app/www/ folder | |
wp db export latest.sql && mv *.sql ../../_db_dumps/ | |
# Local, in: ./ | |
scp _db_dumps/latest.sql user@host:_db_dumps/ | |
# Server, in: ./wordpress/current/: | |
wp db import ~/_db_dumps/latest.sql && wp search-replace "localdomain.test" "productdomain.com" --all-tables |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment