|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I got a full backup of all my mysql databases to a dumpfile dumpfile.sql
how do I restore only one database from that dump file instead of everything? thanks |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Fri, 19 Oct 2007 10:18:11 -0700, "nobody"
<nobody@nobody.com> wrote: >I got a full backup of all my mysql databases to a dumpfile dumpfile.sql > >how do I restore only one database from that dump file instead of >everything? > >thanks > I will assume you produced the backup with: mysqldump -u user -ppassword --all-databases >fulldumpfile You can filter your dumpfile, for example with awk (all on one line): Windows: awk "(($2==\"Current\") && ($4==\"`dbname`\")),(($2==\"Current\") && ($4!=\"`dbname`\")){print}" fulldumpfile >partdumpfile Unix: awk '(($2=="Current") && ($4=="`dbname`")),(($2=="Current") && ($4!="`dbname`")){print}' fulldumpfile >partdumpfile Once you have checked your partdumpfile, you can pipe the command to mysql (again, all on one line): awk "(($2==\"Current\") && ($4==\"`dbname`\")),(($2==\"Current\") && ($4!=\"`dbname`\")){print}" fulldumpfile | mysql -u user -ppassword Good luck -- ( Kees ) c[_] Famous last words - Don't worry, I can handle it. (#441) |
|
![]() |
| Outils de la discussion | |
|
|