parent
eb54b254ca
commit
0651268cba
3 changed files with 26 additions and 3 deletions
@ -0,0 +1,15 @@ |
||||
#! /bin/bash |
||||
TIMESTAMP=$(date +"%F") |
||||
BACKUP_DIR="$HOME/Sites/db-backups" |
||||
MYSQL_USER="root" |
||||
MYSQL_PASSWORD="root" |
||||
MYSQL=/opt/lampp/bin/mysql |
||||
MYSQLDUMP=/opt/lampp/bin/mysqldump |
||||
|
||||
mkdir -p "$BACKUP_DIR" |
||||
|
||||
databases=`$MYSQL --user=$MYSQL_USER -p$MYSQL_PASSWORD -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema)"` |
||||
|
||||
for db in $databases; do |
||||
$MYSQLDUMP --force --opt --user=$MYSQL_USER -p$MYSQL_PASSWORD --databases $db | gzip > "$BACKUP_DIR/$db-$TIMESTAMP.sql.gz" |
||||
done |
Loading…
Reference in new issue