How to rollback a specific table

Asked

Viewed 209 times

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:

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

remembering that my backup is from the entire base.

1 answer

0

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

$ 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 imports your full dump to it then exports the desired table.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.