ERROR 1046 (3D000) at line 22: No database selected
Closed this issue · 2 comments
theniwo commented
When running
docker container exec nextcloud_db_backup_1 /restore.sh /backup/latest.nextcloud.sql.gz
I get that error.
=> Restore database from /backup/latest.nextcloud.sql.gz
ERROR 1046 (3D000) at line 22: No database selected
=> Restore failed
Part of my compose file:
db_backup:
image: fradelg/mysql-cron-backup
restart: unless-stopped
depends_on:
- db
env_file:
- ./db.env
- ./global.env
environment:
- MYSQL_DB=nextcloud
- MYSQL_HOST=db
- MYSQL_PORT=3306
- MYSQL_USER=nextcloud
- MAX_BACKUPS=15
- INIT_BACKUP=1
# Every day at 03:00
- CRON_TIME=0 3 * * *
# Make it small
- GZIP_LEVEL=9
volumes:
- db_backup:/backup
fradelg commented
Hi,
can you try using this image tag?
fradelg/mysql-cron-backup:1.4.0
BTW: put always a tag to your run to fix the version of the image you are running.
I'm afraid this can be due to the removal of the flag --databases in this PR:
If this is the case, you can add manually the statements CREATE or USE to the beginning of the SQL dump. Check this link:
https://stackoverflow.com/questions/4005409/error-1046-no-database-selected-how-to-resolve
Regards
theniwo commented
fradelg/mysql-cron-backup:1.4.0
does work. Thank you