How to backup all Databases to single file in MySQL or MairaDB by using mysqldump

Scenario:

You are working as MySQL/ MariaDB DBA, you have a MySQL or MariaDB service on which you have many databases, you need to take backup of all the databases in single file. Later this file can be used on same of different Server for restore purpose.

Solution:

mysqldump program can be used to take backup of all the databases in single file. Below statement should do the trick.

mysqldump -u root -p --all-databases >/destinationdirectory/AllDatabases.sql

Video Demo : How to backup all databases to single file in MySQL or MariaDB by using mysqldump