Tag Archives: mysql backup

Backup And Restore Multiple Databases In MYSQL

In this post we will learn how to perform backup of multiple databases and restore them in MySQL server.

To perform multiple database backup execute below command.

[root@server1 ~]# mysqldump -u root -p –databases test vin zahid > Multiple_DBs.sql
Enter password:
[root@server1 ~]#

Now check whether backup has been perform or not.

[root@server1 ~]# ls -ltr Multiple_DBs.sql
-rw-r–r– 1 root root 88089816 Aug 12 10:49 Multiple_DBs.sql

Note
Change name of databases as per your requirement.

Now login to mysql database and drop databases you have perform backup.
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| test |
| vin |
| zahid |
+——————–+
5 rows in set (0.00 sec)

mysql>
mysql> drop database test;
Query OK, 0 rows affected (0.07 sec)

mysql> drop database vin;
Query OK, 1 row affected (0.60 sec)

mysql> drop database zahid;
Query OK, 1 row affected (0.06 sec)

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
+——————–+
2 rows in set (0.00 sec)

Now Restore databases using below command.

[root@server1 ~]# mysql -u root -p show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| test |
| vin |
| zahid |
+——————–+
5 rows in set (0.00 sec)

Now all the databases we have dropped have been created in MySQL.

Other techniques of batabases backup and restorations i will share in next post.