I recently used this to backup and restore all the databases in one single file. This works for small sized databases very well and is a quick and easy way to backup and restore all local databases. Very useful for testing and quick restore. Issue this command at the command prompt.
mysqldump -u <username> -p --all-databases > all_databases.sql
Restore all databases by logging in to mysql with
mysql -u <username> -p SOURCE all_databases.sql (if you are in the directory with all_databases.sql or prepend the path)