How to rollback a specific table

1

I have a backup of my entire base of all tables from the following command:

mysqldump --default-character-set=latin1 -u root -p[senha] [base] > Z:Backup

I wanted to do something like this:

mysqldump --default-character-set=latin1 -u root -p[senha] [base] -table [tabela_em_especifico]< Z:Backup

Remembering that my backup is from the entire database.

    
asked by anonymous 18.07.2018 / 21:57

1 answer

0

You can use a word processing tool to create new file with only desired table sed example:

$ sed -n -e '/CREATE TABLE.*'nome_tabela'/,/UNLOCK TABLES/p' backup.dump > backup_tabela.dump

or

sed -n -e '/DROP TABLE.*'nome_tabela'/,/UNLOCK TABLES/p' backup.dump > backup.dump > backup_tabela.dump

Or you can create temporary database import your full dump to it then export the desired table.

    
19.07.2018 / 18:26