How to backup all Databases in MySQL | InfoZonePK

Use the following command to take all the databases backup in MySQL, type these commands don’t use copy, paste.

mysqldump -all-databases -p | bzip2 -c > alldatabasesbackup.sql.bz2

Enter password:


This will put all of the databases in a compressed bzip2 fil. Transfer the file to your other server and decompress by this command.

bzip2 -d alldatabasesbackup.sql.bz2

Restore your backup by using this mysql command.

mysql -o < alldatabasesbackup.sql

Enter password: