Grow Your Business Online.
Submit a ticket My Tickets
Welcome
Login  Sign up

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


With stored procedures/functions,

C:\mysql\bin> mysqldump -u username -p password —routines database > dumpfile.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 > dumpfile.sql


With stored procedures/functions,

mysqldump -u username -p password —routines 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


With stored procedures/functions,

mysqldump —routines database > dumpfile.sql


Restore:
mysql newdatabasename < dumpfile.sql

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

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.