Skip to content

Dump all MySQL-databases from command-line

Need to make a complete dump of all databases in your MySQL-server? Then this command is quite handy;

mysqldump -h  -u -p --all-databases | gzip -9 > /location/for/backup/mysqldump.gz

This will prompt for a password — however, if you want to script it, you can of course put this in the command;

mysqldump -h  -u -p --all-databases | gzip -9 > /location/for/backup/mysqldump.gz

Also keep in mind that the database(s) will be locked while backing up, to avoid things to be written/changed/deleted while backing up (which would cause inconsistency).

Leave a Reply

Your email address will not be published. Required fields are marked *