MySQL restore multiple databases
n a
boredandblogging at gmail.com
Mon Feb 26 04:11:04 UTC 2007
Are you using something like mysqldump to do backups? Usually, right after
the CREATE DATABASE sql, there is another statement like USE 'databasename'
which switches to the newly created database.
Basically the SQL would apply to whatever database the last USE 'db' was
done for.
As long as the dump file has all the correct CREATE and USE statements in
the right order (which they would assuming you use something like
mysqldump), you can run almost the same command to restore the databases,
just without a specific database name:
mysql --user=username --pass=password --host=dbserver < /path/file.sql
nick
On 2/25/07, Emil Edeholt <emil at knmedical.se> wrote:
>
> Hello!
>
> I hope this is not off topic. When I restore one database from an sql
> file I run:
>
> mysql --user=username --pass=password --host=dbserver database <
> /path/file.sql
>
> But now I have one big sql file with all my databases and a CREATE
> DATABASE for every database.
>
> How do I import this sql file into mysql so all databases are restored?
> (So I won't have to update my backup script everytime I add a database
> in mysql).
>
> I hope I explained this clearly enough... Thanks for your time!
>
> Best regards Emil
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20070225/4e35b68a/attachment.html>
More information about the ubuntu-users
mailing list