The DROP DATABASE
and CREATE DATABASE
commands are generally not part of a default dump operation. You will need to add one item to your command:
--databases
or -B
:
This will allow you to dump several databases if you wish, but you can also use this option if you would like to have CREATE DATABASE
and USE
inlaced in the output before each database is defined.
A note about --add-drop-database
:
As one would expect, this option will add a DROP DATABASE
statement before each CREATE DATABASE
. This option is generally used alongside the --all-databases
or —databases
options as there is no CREATE DATABASE
statements written without one of these options specified.
So, with this in mind, your command would look like this:
C:\Program Files (x86)\MariaDB 10.5\bin\mysqldump" --skip-comments --compact --lock-tables=false --add-drop-database --host=localhost --user=trainer --password=PASSWORD --databases training > C:\Users\splatten\Documents\TrainerS1D5.sql
Note: I'm not sure if the forward slashes you used in the command were intentional or not. I've replaced them with backslashes as Windows generally requires. Feel free to switch them back if this is in error.