guessi / docker-yourls

Dockerize YOURLS service (Shorten URL Service)
https://hub.docker.com/r/guessi/docker-yourls/
27 stars 16 forks source link

Restore from backup #2

Closed icecat44 closed 1 year ago

icecat44 commented 2 years ago

Hello! Made a backup as described in the README, when trying to restore I get an error: mysql_1 | 2021-12-08 08:46:36+00:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/mysql-dump-2021-12-08-081258.sql mysql_1 | ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqldump: [Warning] Using a password on the command line interface can be insec' at line 1

guessi commented 2 years ago

@icecat44 just try to run exactly the same commands as described in README.md, but I'm not able to reproduce the issue like yours. Could you please share more information so that I could find out the root cause for you.

Q1. What Docker version are you running with? Q2. What docker-compose version you are running with? Q3. Is the backup created by the script provided? backup.sh Q4. If the backup is not created by the script provided, what MySQL client version you used for creating backup file? Q5. Did you made any change to the backup file?

If possible, please attach complete log output, and please do remember to remove sensitive information from log file (if any). And the following snippet is the log output that I just verified for your reference, I believe it should be functional as expected.

% docker-compose up -d

% ./backup.sh
BACKUP FILE: mysql-dump-2021-12-15-211205.sql

% ls "*.sql"
./mysql-dump-2021-12-15-211205.sql

% docker-compose down
[+] Running 3/2
 ⠿ Container yourls_yourls_1  Removed                                                                                                                                                                                                    1.2s
 ⠿ Container yourls_mysql_1   Removed                                                                                                                                                                                                    1.9s
 ⠿ Network yourls_default     Removed                                                                                                                                                                                                    0.1s

% docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

% docker volume rm yourls_mysql-data
yourls_mysql-data

% rm -vf ./volumes/docker-entrypoint-initdb.d/*
zsh: sure you want to delete all the files in ./volumes/docker-entrypoint-initdb.d [yn]? y
zsh: no matches found: ./volumes/docker-entrypoint-initdb.d/*

% cp -vf ./mysql-dump-2021-12-15-211205.sql volumes/docker-entrypoint-initdb.d
./mysql-dump-2021-12-15-211205.sql -> volumes/docker-entrypoint-initdb.d/mysql-dump-2021-12-15-211205.sql

% docker-compose up

<skipped>

mysql_1   | 2021-12-15 13:15:22+00:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/mysql-dump-2021-12-15-211205.sql

<skipped>

mysql_1   | 2021-12-15 13:15:24+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
mysql_1   |
mysql_1   | 2021-12-15T13:15:24.808400Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql_1   | 2021-12-15T13:15:24.809661Z 0 [Note] mysqld (mysqld 5.7.36) starting as process 1 ...

<skipped>

mysql_1   | Version: '5.7.36'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)