Backup and Restore many mysql database in one shot

Its my bad for not reading database manual that lead me for doing boring task .

Dump a few database from server and dumping it in my windows xp. one by one.

Perhaps someone who see this post can learn and not doing same mistake as me.

Command to backup one database :

backup database pendidikan :

edp# mysqldump -ualam -p pendidikan > pd.sql

backup database cms_study :

edp# mysqldump -ualam -p cms_study> cms1.sql

backup database cms_stmik :

edp# mysqldump -ualam -p cms_stmik > cms2.sql

backup database bimbel :

edp# mysqldump -ualam -p bimbel  > bimbel.sql

those command can be replace by this one :

edp# mysqldump -ualam -p –databases pendidikan cms_study cms_stmik bimbel > alldb.sql

My question :

How to identified the origin of database?

simply test it in my windows xp box :

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\alam>cd c:\appserv\mysql\bin

C:\AppServ\mysql\bin>mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 4.0.24-nt

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> create database cms_stmik;
Query OK, 1 row affected (0.00 sec)

mysql> create database cms_study;
Query OK, 1 row affected (0.00 sec)

mysql> create database bimbel;
Query OK, 1 row affected (0.00 sec)

mysql> create database pendidikan;
Query OK, 1 row affected (0.00 sec)

Test each database, see tables inside databases.

mysql> use bimbel;
Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql> use pendidikan;
Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql> exit
Bye

C:\AppServ\mysql\bin>dir /p/w
 Volume in drive C has no label.
 Volume Serial Number is F8D9-6881

 Directory of C:\AppServ\mysql\bin

[.]                   [..]                 
libmySQL.dll          mysql.exe             mysqladmin.exe       
mysqlc.exe            mysqlcheck.exe        mysqld-nt.exe
mysqld.exe            mysqldump.exe         mysqlimport.exe
mysqlshow.exe     mysqlshutdown.exe     mysqlwatch.exe
perror.exe              mysqlbinlog.exe
alldb.sql
              20 File(s)    714,655,891 bytes
               2 Dir(s)   4,073,820,160 bytes free

import / restore database back into corresponding database :

C:\AppServ\mysql\bin>mysql -uroot -p < alldb.sql
Enter password:

C:\AppServ\mysql\bin>mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15 to server version: 4.0.24-nt

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffe

try to see database bimbel and its tables

mysql> use cms_study;
Database changed
mysql> show tables;
+———————+
| Tables_in_cms_study |
+———————+
| adminuser                     |
| blok_materi                   |
| chapter                           |
| lesson                            |
| links                                |
| membertable                |
| menu                              |
| page                               |
| rel_terms                      |
| subchapter                   |
| terms                             |
| user                               |
| user_menu                  |
+———————+
13 rows in set (0.00 sec)

mysql>

Great get one sql file and import one sql file.

I love this tool 🙂