Last active
December 17, 2015 00:49
-
-
Save Dare-NZ/5523584 to your computer and use it in GitHub Desktop.
Some SSH functions for backing up a MYSQL DB, zipping it and shipping it off to a remote server.
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
// Obviously {this} means replace with your version of this | |
// Dump DB | |
mysqldump -p -u {username} {dbname} > {dbname.sql} | |
// Tar DB | |
tar -cvf {dbname.tar} {dbname.sql} | |
// Move DB | |
curl -T {dbname.tar} ftp://{remote path}/{dbname.sql} --user {username}:{password} -v | |
// Remove leftovers | |
rm {dbname.sql} | |
rm {dbname.tar} | |
// If you want to install on the remote server | |
tar -xvf {dbname.tar} | |
mysql -u {username} -p {dbname} < {dbname.sql} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment