Skip to content

Instantly share code, notes, and snippets.

@4selin
Last active September 2, 2018 13:58
Show Gist options
  • Save 4selin/e944fd930498bace0b1dcb576a0c7b65 to your computer and use it in GitHub Desktop.
Save 4selin/e944fd930498bace0b1dcb576a0c7b65 to your computer and use it in GitHub Desktop.
#!/bin/bash -v
#Remote
remote_user=
remote_ip=
remote_db=
remote_db_user=
remote_db_password=
#Local
local_db=
local_db_user=
local_db_password=
home_url=
prefix=wp_
#Let's go
ssh ${remote_user}@${remote_ip} "mysqldump -u${remote_db_user} -p${remote_db_password} ${remote_db} | gzip -3 -c" | gunzip | mysql -u${local_db_user} -p${local_db_password} ${local_db}
mysql -u${local_db_user} -p${local_db_password} -e "UPDATE ${local_db}.${prefix}options SET option_value = '${home_url}' WHERE option_name IN ('siteurl','home')"
cd web
wp cache flush
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment