MySQL Database Dump

MySQL Database Dump using Command prompt.
Get a backup
command :
 mysqldump -u[user name] -p[password] [database name] > [dump file name]

eg :
C:\Documents and Settings\sameera>mysqldump -u root -p mydb>"C:\Documents and Settings\sameera\Desktop\mydumpfile.sql"

Restore Back up
 1)
command :
 mysql -u[user name] -p[password] [database name] < [dump file name]

eg :

 C:\Documents and Settings\sameera>mysql -u root -p mydb < "C:\Documents and Settings\sameera\Desktop\mydumpfile.sql"



2)
command :
source [dump file name]

eg:
mysql>create database mydb;
mysql> use mydb
mysql> source C:/Documents and Settings/sameera/Desktop/mydumpfile.sql;

Note: Path separator should be forward slash("/")

No comments:

Post a Comment