From ae753e40a1736c32b19a0551cc36dba82f5feb30 Mon Sep 17 00:00:00 2001 From: "Markus \"Shorty\" Uckelmann" Date: Thu, 7 Sep 2017 17:10:15 +0200 Subject: [PATCH] Fixes missing USE statement in SQL dump This commit adds the additional `--databases` option to the mysqldump command. This adds a `USE database` statement to the beginning of the SQL dump. Without this one has to provide the database name at restore. --- backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 backup.sh diff --git a/backup.sh b/backup.sh old mode 100644 new mode 100755 index f0d427c..d2ca3dd --- a/backup.sh +++ b/backup.sh @@ -11,7 +11,7 @@ do then echo "Dumping database: $db" FILENAME=/backup/$DATE.$db.sql - if mysqldump -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" "$db" > "$FILENAME" + if mysqldump -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" --databases "$db" > "$FILENAME" then gzip -f "$FILENAME" else