- Backup of one table:
# mysqldump -uusername -p /path/file.sqlpassword > - Restore one table:
# mysql --user=username --pass=password --host=localhost db_name < /path/file.sql
Backup of DB:
- # mysqldump -u username -p password > /path/file.sql
- We have to know where one table starts and where ends:
# grep -n 'Table structure' /path/file.sql - Then we have to separate part of file with required table into new file using line number gathered in previous command (where 7506 is start and 17684 is end):
# sed -n '7506,17684 p' /path/file.sql> /path/new_file.sql - Then we can restore it into DB:
# mysql --user=username --pass=password --host=localhost db_name < /path/file.sql
No comments:
Post a Comment