Page 1 of 1

[SOLVED] Fail to restore MySQL dump

PostPosted:Mon Jun 28, 2021 8:10 pm
by LauryMenton
Hello, I'm trying to restore the dump, as explained in the official doc, but it fails.

I can create the dump and create user without errors, but when I try to restore the DB into the new (blank) DB, it shows me a 'TTY' error:
Some like: "The input device is not a TTY".

I tried, as shown somewhere, with:
Code: Select all
docker-compose exec -it CONTAINER_ID mysql -h 127.0.0.1 -u root -popenkm okmdb < /mnt/user/BACKUPS/Docker/OpenKM/MYSQL_DB/okmdb_bkp.sql
Now the console doesn't show any error. It just finishes. But when I take a look inside the restored DB, nothing is there. The DB stills blank. So, the command doesn't restore the dump.

The error appears when I try to run the following command, as described in the official doc (adapted to work with docker container):
Code: Select all
docker exec -it CONTAINER_ID mysql -h 127.0.0.1 -u root -popenkm okmdb < /mnt/user/BACKUPS/Docker/OpenKM/MYSQL_DB/okmdb_bkp.sql
I create the DB dump using the following command (it works perfectly, after checking the file):
Code: Select all
docker exec -it CONTAINER_ID mysqldump -h 127.0.0.1 -u root -popenkm okmdb > /mnt/user/BACKUPS/Docker/OpenKM/MYSQL_DB/okmdb_bkp.sql

Re: Fail to restore MySQL dump

PostPosted:Tue Jun 29, 2021 6:22 am
by pavila
I think you can try any of these commands:
Code: Select all
cat /tmp/sample.sql | docker exec -i CONTAINER_ID mysql
or
Code: Select all
docker exec -i CONTAINER_ID mysql < /tmp/sample.sql
But if none of these options work, this is a Docker question and you should ask in a Docker forum.

Re: Fail to restore MySQL dump

PostPosted:Wed Jul 07, 2021 6:48 am
by LauryMenton
Thank you for your reply, but it was failing because a 'warning' msg was written into the DB, maybe, for debbuging purposes.

So, after deleting that line (nº 1) from the DB dump file, the DB was restored succesfully.

Image

Re: [SOLVED] Fail to restore MySQL dump

PostPosted:Sat Jul 10, 2021 1:12 pm
by jllort
thanks for sharing. Anyway, this error is quite strange because the two characters "-- " is the standard comment for MySQL line and should not be considered in any manner. I suggest sharing the issue with MySQL or MariaDB guys because it seems like a bug.