Backup and Restore Mysql Database using Mysqldump

Below are mysqldump commands for backup and restore mysql database:

WINDOWS:

Backup:
C:\mysql\bin> mysqldump -u username -p password database > dumbfile.sql

Restore:
C:\mysql\bin>mysql -u username -p password database < dumpfile.sql


UNIX / LINUX

Method A (followed by the user database username and password)
=======
Backup:
mysqldump -u username -p password database > dumbfile.sql

Restore:
mysql -u username -p password database < dumbfile.sql

Method B (backup and restore with root access)
========
Backup:
mysqldump databasename > dumpfile.sql

Restore:
mysql newdatabasename < dumpfile.sql

 

Backup:
Notes: 
- dumbfile.sql contains SQL command for creating tables and data. (CREATE,INSERT,DROP etc.)

Add Feedback