You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
458 B
21 lines
458 B
#!/bin/bash |
|
|
|
# Settings |
|
MYSQL="$(which mysql)" |
|
MYSQLDUMP="$(which mysqldump)" |
|
GZIP="$(which gzip)" |
|
MyUSER="sys_backup" |
|
MyPASS="secretpassword" |
|
DIR="/backup/sql" |
|
NOW="$(date +"%Y-%m-%d")" |
|
|
|
# Get all the databases in your server |
|
DBS="$($MYSQL -u $MyUSER -p$MyPASS -Bse 'show databases')" |
|
|
|
for db in $DBS |
|
do |
|
if [ "$db" != "information_schema" ]; then |
|
FILE="$DIR/$db.$NOW.gz" |
|
$MYSQLDUMP --routines -u $MyUSER -p$MyPASS $db | $GZIP -9 > $FILE |
|
fi |
|
done
|
|
|