Created
March 24, 2020 00:04
-
-
Save seieric/71d124195d66eaaf2ebb4666ce9e4ec9 to your computer and use it in GitHub Desktop.
MySQL backup script
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/sh | |
databases=("aaaaaaaaa" "xxxxxxx") | |
passwords=("qwerty" "asdfgh") | |
i=0 | |
for database in ${databases[@]} | |
do | |
time=`date +%Y%m%d%H%M%S` | |
output_path="/home/user/_db_dump/mysql.${database}.${time}.dump" | |
/usr/bin/mysqldump ${database} -u ${database} --password=${passwords[i]} > ${output_path} | |
let i++ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment