Sunday, 2 December 2012

Backup and Restore MySQL Database Using mysqldump


How to backup mysql database using "mysqldump"

         mysqldump is an effective tool to backup MySQL database

Backup a single database

     [root@sysadmin ~]#  mysqldump   -u   root   -p   test   >   test.sql

         test --> database name
 test.sql --> dumpfile name

Backup multiple databases

              [root@sysadmin ~]#  mysqldump  -u  root  -p   --databases  test1  test2  >  test1_test2.sql

test1 and test2 --> database name

Backup all the databases

              [root@sysadmin ~]#  mysqldump  -u   root   -p   --all-databases  >  all-database.sql


How to Restore MySQL Database:

      [root@sysadmin ~]#  mysql  -u  root  -p  test  <  test.sql

test --> database name
  test.sql --> dumpfile name


No comments:

Post a Comment