MySQLdump is very effective tool to collection of databases for backup or restore into another SQL server. There are three general ways to use mysqldump command in Linux server.

mysqldump  advantage is flexibility of viewing the dump file or even editing the output before restoring it.

Dump  set of one or more database with particular tables.

mysqldump [options] db_name [table_names]

 Dump set of one or more complete database
 
mysqldump [options] --databases db_name

Dump an entire mysql server
 
mysqldump [options] --all-databases

How To take a  database Backup in MySQL :

Before taking a dump a backup has to select the name of the database.

mysql> show databases;
mysql> show databases;
+------------------------------+
| Database                   |
+-------------------------------+
| information_schema         |
| mysqlbackup                |
| testmysqldb                |
| mysql_db                   |
| db_backup                  |
| mysql                      |
| test                       |
+------------------------------+


I have chosen the database name is testmysqldb and  dumps the output to testmysqldb.sql  and just read the below options.

-u is user name
-p is password
-A is All Databases
-d is Do not write any row information 

Syntax:

mysqldump -u user_name -p password  database_name > /destination/path/backup.sql
 
#  mysqldump -u root -p password testmysqldb.sql  > testmysqldb.sql 

Below content showing sample output of mysqldump file
 
-- Table structure for table ` mysqldb `
DROP TABLE IF EXISTS `mysqldb`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mysqldb` (….

Multiple  database backup in a command:

Below example takes a multiple databases (mysqlbackup, mysql_db, db_backup ) backup in single command and dumps the output to  mysqlbackup.sql
 
#  mysqldump -u root -p password mysqlbackup mysql_db db_backup > mysqlbackup.sql

Backup a specific tables :

Below example takes one table  id_test from testmylsqldb database
 
#  mysqldump -u root -p password  testmysqldb  id_test > /tmp/testmysqldb_id_test.sql

Sample output of table backup:
 
- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `user` (
  `ID` int(11) NOT NULL auto_increment,
...

Dump ALL MySQL Databases :

Below example to take a backup of all databases dump the output to  mysqlbackup_all.sql ,  use any one option --all-databases or -A
 
#  mysqldump -u root -p password -A > mysqlbackup_all.sql

Dump mysql database structure only:

if you want to get a dump of only the  database structure without any data,
 
#mysqldump -u root -p password -d mysqldb > mysqldb.sql

Restore MySQL database:

To restore the backup file into another server testmysqldb, execute mysql  with ‘ < ’ symbol (less than). Before restored that backup need to create a new database.
 
#  mysql -u root -p password testmysqldb < testmysqldb.sql

If you want to see your version of mysqldump run the command: 
 
# mysqldump -V

mysqldump  Ver 10.13 Distrib 5.5.34, for Linux (x86_64)
will displaying full details about mysqldump usages and Options
root@host [~]# mysqldump --help  

Sometimes, do you feel it’s a difficult to take  backup or restore databases  by  above commands, we will do that in PHPMyAdmin Tool.