Created
October 10, 2018 03:58
-
-
Save tieutantan/c947e66f8f024042f76b2dbe8214d107 to your computer and use it in GitHub Desktop.
Shell Script Backup Mysql Database
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
#!/bin/sh | |
DUMPFILE=/home/thisisusername/backups/db-`date +%Y-%m-%d-%H-%M`.sql.gz | |
mysqldump -uthisisusername -p'ZjOGUxPass' -hlocalhost database_name --force --triggers --single-transaction --opt --skip-lock-tables | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | gzip -9 -c > $DUMPFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment