1

I know how to restore table from mysqldump.sql file. But is it possible to restore single table from mysqldump.sql.gz?

I know that there is very similar question to mine, but I want to restore data from file that is .sql.gz, and I saw only methods with one suffix.

I also know, that I can just decompress the file, but preferably I would like to restore table without decompressing whole backup.

anzzz
  • 35
  • 3
  • Does this answer your question? [Can I restore a single table from a full mysql mysqldump file?](https://stackoverflow.com/questions/1013852/can-i-restore-a-single-table-from-a-full-mysql-mysqldump-file) – effedici Dec 14 '21 at 15:05
  • @effedici sadly no, because there are only files with .sql or .gz, and I need to restore sable from file that is .sql and also .gz (mysqldump.sql.gz) – anzzz Dec 16 '21 at 06:59

1 Answers1

0

I think that you can try with sed command in terminal.

If your table is named users try to do it like that :

$ sed -n -e '/CREATE TABLE.*`users`/,/Table structure for table/p' mysqldump.sql.gz > users.dump

This will copy the information between CREATE TABLE and next table from your dump to users.dump.

After that you know what to do ;)