I have an old_server
with 50 databases. I want to create new_server
with just 3 databases.
When I try using mysqldump
, it seems like all the database directories (although they are empty on new_server
) and many unnecessary support files for the other 47 tables are being copied.
Is there any way to avoid this (or clean up afterwards, if unavoidable)? I would like new_server
to be as clean as possible, with no traces of those other 47 databases, if at all possible.
I am tempted to delete those files and directories directly from the file system (or at least temporarily move them to /tmp), but I'd like to avoid this if possible.
Best Answer
If you would like to detect which databases actually contain MySQL data, you can run the following query:
Any database with no tables in it simply do not appear in this query's result set.
How do you mysqldump these nonempty databases? Using the aforementioned query, like this:
Give it a Try !!!