According to MySQL official Documentation :
The mysqldump client utility performs logical backups, producing a set of SQL statements that can be executed to reproduce the original database object definitions and table data. It dumps one or more MySQL databases for backup or transfer to another SQL server. The mysqldump command can also generate output in CSV, other delimited text, or XML format.
Format of mysqldump
mysqldump [options] > dump.sql
Single MySQL Database
mysqldump -u username -p database_name > database_name.sql
Here username is you mysql username like root, then it will prompt for a password, then give the password for authentication. After successful password it will export the file
Multiple MySQL Databases
mysqldump -u root -p --databases database_name_1 database_name_1 > databases_1_2.sql
All MySQL Databases
mysqldump -u root -p --all-databases > all_databases.sql
Restore a single database
mysql -u root -p -e "create database database_name";
Restoring all dump db in a single command
mysql -uroot -p < all_databases.sql
Ask for a password give that all Done.
Note : This article is taken from linuxize. I just put the summary here, they give very much details.