Extract one database from fullbackup.sql

mysql -u root -p c1mistral
# then inside mysql prompt:
SET FOREIGN_KEY_CHECKS=0;
SOURCE /full/path/to/c1mistral.sql;
SET FOREIGN_KEY_CHECKS=1;
exit




awk -v db="c1mistral" '$0 ~ "^-- Current Database: " db "" {flag=1} $0 ~ "^-- Current Database: " && flag && $0 !~ "^-- Current Database: " db "`" {flag=0} flag' full-backup.sql > c1mistral.sql

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *