Restore a MySQL Database

Submitted by:Jhon Jhon

Date added:29 December, 2012

Category:MySQL

How to Back Up and Restore a MySQL Database

Tags: restore database

Code Snippet:

    /* Back up From the Command Line (using mysqldump) */
mysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql]

/* Back up your MySQL Database with Compress */
mysqldump -u [uname] -p[pass] [dbname] | gzip -9 > [backupfile.sql.gz]

/* Restoring your MySQL Database */
mysql -u [uname] -p[pass] [db_to_restore] < [backupfile.sql]
 
 

Comments