Last active
May 30, 2024 15:21
-
-
Save nimdasx/609a675d018cf4ce4abf2e9a8708dd11 to your computer and use it in GitHub Desktop.
mysql-backup.sh
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
prefix=$(hostname) | |
host=0.0.0.0 | |
user=root | |
pass=xxx | |
port=3306 | |
databases="xxx yyy" | |
lokasi="./" | |
for database in $databases | |
do | |
echo $database | |
mysqldump -h$host -u$user -p$pass -R -P$port $database | pv -W -s 100m | gzip > $lokasi$prefix-$database-$(date +"%Y-%m-%d_%H-%M-%S").sql.gz | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment