Spezzare un dump di multi DB

Da wiki.gienne.cloud.
Extracting a Single Database From a mysqldump File containing –all-databases Dump.
Imagine to have a full MySQL DB Dump (containing a lot of Single Database Dumps) and imagine also to need the extraction or restoration of a single one. This is a quite common task that can be accomplished using some shell commands.

1. Using the mysql command line client’s –one-database option:

mysql -u root -p --one-database B_To_Be_Restored < FullDump_File.sql

2. Using ‘sed’ to extract the Dump from the dump file:

sed -n '/^-- Current Database: `DB_To_Be_Restored`/,/^-- Current Database: `/p' FullDump_File.sql > DB_To_Be_Restored.sql
 Tags: --all-databases, DataBase, DB, DB Dump, Dump, MySQL, mysqldump, Restore

 This entry was posted on Thursday, December 11th, 2014 at 11:50 AMand is filed under . You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Source: https://blog.bravi.org/?p=1205