Last active
December 19, 2015 03:19
-
-
Save sarahmonster/5889465 to your computer and use it in GitHub Desktop.
A series of files to include in your git directory in order to automate WordpPress database syncs.
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
USE DBNAME_LOCAL; | |
UPDATE wp_EXT_options SET option_value="http://LOCALURL:8888" WHERE option_name="siteurl"; | |
UPDATE wp_EXT_options SET option_value="http://LOCALURL:8888" WHERE option_name="home"; |
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
USE DBNAME_REMOTE; | |
UPDATE wp_EXT_options SET option_value="http://REMOTEURL.com" WHERE option_name="siteurl"; | |
UPDATE wp_EXT_options SET option_value="http://REMOTEURL.com" WHERE option_name="home"; |
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
git pull https://REMOTE-REPOSITORY-URL.git | |
cd db | |
mysql -uUSERNAME -pPASSWORD DBNAME < db_sync.sql | |
mysql -uUSERNAME -pPASSWORD DBNAME < db_local.sql |
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
git pull https://REMOTE-REPOSITORY-URL.git | |
cd db | |
mysql -hREMOTEHOSTNAME -uUSERNAME -pPASSWORD DBNAME < db_sync.sql | |
mysql -hREMOTEHOSTNAME -uUSERNAME -pPASSWORD DBNAME < db_remote.sql |
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
mysqldump -uUSERNAME -pPASSWORD DBNAME > db/db_sync.sql | |
# If using MAMP and getting a socket error | |
# mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect | |
# Specify the socket in the mysqldump command by using the line below instead | |
# | |
# mysqldump --socket=/Applications/MAMP/tmp/mysql/mysql.sock -uUSERNAME -pPASSWORD DBNAME > db/db_sync.sql |
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
mysqldump -hREMOTEHOSTNAME -uUSERNAME -pPASSWORD DBNAME > db/db_sync.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment