Friday, September 26, 2008

Back up and Restore Database in MySql

Back up the Database:
1.Go to Windows Command Promot.
2.Go to "C:\Program Files\MySQL\MySQL Server 5.0\bin".(see the Picture)
3.Get the Backup using the following Query.

Syntax : mysqldump -u user -ppass DB_name > FILE.sql
Example : mysqldump -u user -psa Test > Test.sql


Restore the Database:
1.Open Mysql command Promt.
2.Drop the Database.
3.Create the new Database.
4.Use the following qry to restore the Database.

Syntax : Source File.SQL
Example : Source Test.SQL