Skip to content

Instantly share code, notes, and snippets.

@AndreasGrip
Created January 12, 2022 07:35
Show Gist options
  • Save AndreasGrip/4330ad4efb7fdfc5be57c35cd833209a to your computer and use it in GitHub Desktop.
Save AndreasGrip/4330ad4efb7fdfc5be57c35cd833209a to your computer and use it in GitHub Desktop.
Dump/backup mysql database.
#!/bin/sh
#"password" should be replaced with your password
#"database1" and "database2" should be replaced with the names of your databases.
TIMESTAMP=$(date +%Y-%m-%d_%H%M%S)
mysqldump -u root -ppassword database1 | gzip > database1_$TIMESTAMP.dump.sql.gz
mysqldump -u root -ppassword database2 | gzip > database2_$TIMESTAMP.dump.sql.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment