To backup a MySQL database we need to know a name of the specific database we would liken to backup. Let's assume that we are going to backup a database named mysql-data.
$ mysqldump -u root -p mysql-data mysql-data-backup.sql
The previous command will dump / backup database mysql-data into a file mysql-data-backup.sql. -u option specifies a user with access to the mysql-data database and -p option will prompt for a root password.
To restore a MySQL database from a backup file the following command can be used:
$ mysql -u root -p mysql-data < mysql-data-backup.sql
This will restore a database from a backup file to a destination database mysql-data. Usage of -p and -u options with mysql command is the same as in previous command.