How to do a mysqldump with a use database in the dump So the command I normally use to get a database sent to another server is:
mysqldump -u user -p --add-drop-tables database *file*

But I always have to go into the file and add a line at the top:
use database;

So that I use the file to import to a different server. Is there a flag in mysqldump to automatically add the use database?
The flag is --databases

mysqldump -u user -p --add-drop-tables --databases database &gt; *file*


So if you have more than one schema names you need to set which databases with the --databases flag. Then it inserts which one is necessary to be used.