# mysqldump all-databases
option
--all-databases
is a mysqldump
option that is used when you want to include all the databases in your dump.
mysqldump --all-databases > my_backup.sql
When executing the command from above, the dump file will contain all the databases. Before each database, a CREATE STATEMENT
is written. In case you want to also write a DROP DATABASE
statement before each CREATE DATABASE
, use the --add-drop-database option.
# Write a DROP DATABASE statement before each CREATE DATABASE statement
mysqldump --all-databases --add-drop-database > my_backup.sql
If you want to find more details about how to backup one, more or all your databases at once, this article covers that.