Skip to content

Instantly share code, notes, and snippets.

@rsperl
Last active July 25, 2022 13:12
Show Gist options
  • Save rsperl/83725a1795ede0d470b8bd43f9a74d70 to your computer and use it in GitHub Desktop.
Save rsperl/83725a1795ede0d470b8bd43f9a74d70 to your computer and use it in GitHub Desktop.
backup mysql #snippet
#!/usr/bin/env bash
login_path="$1"
database_name="$2"
dir="$HOME/.mysql_backups"
/usr/local/bin/mysqldump --login-path="$login_path" "$database_name" | gzip > "$dir/$database_name-$(/bin/date +%Y-%m-%d_%H%M%S).sql.gz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment