mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2025-01-18 16:22:33 +01:00
Fixes missing USE statement in SQL dump
This commit adds the additional `--databases` to the mysqldump command. This adds a `USE database` statement to the beginning of the SQl dump. Without this one hast to provide the database name at the restore.
This commit is contained in:
parent
b3bb91adf7
commit
61aed96c0f
1 changed files with 1 additions and 1 deletions
2
backup.sh
Normal file → Executable file
2
backup.sh
Normal file → Executable file
|
@ -10,7 +10,7 @@ for db in $databases; 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
|
||||
|
|
Loading…
Reference in a new issue