Last active
August 31, 2023 20:50
-
-
Save renegarcia/fc621892f38dae7f885fdebcf1fbdbfc to your computer and use it in GitHub Desktop.
Database backup for python anywhere
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
#!/bin/bash | |
USERNAME="writeyourusernmehere" | |
HOST="$USERNAME.mysql.pythonanywhere-services.com" | |
TABLENAME='your table name' | |
NOW=`date --iso-8601=seconds` | |
DBDIR=$HOME/db-backup | |
BACKUP_FILE="$DBDIR"/db-backup-"$NOW".sql.gz | |
mysqldump -u $USERNAME -h $HOST --set-gtid-purged=OFF --no-tablespaces --column-statistics=0 "$TABLENAME" | gzip > "$BACKUP_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure you create the
db-backup
folder first and place this file in it.