Search Our Database

How to Backup/Restore MySQL database with mysqldump command

Last updated on |
by

Mysqldump is an effective tool to backup MySQL database. It creates an .sql file with DROP table, CREATE table and INSERT into sql-statements of the source database.

1. To back up a database, use the command as below:

#mysqldump -u db_username -p [database_name] > dumpfilename.sql

Key in the password when requested.

2. To restore a database, use command as below:

#mysql -u [db_username] -p [database_name] < dumpfilename.sql

Key in the password when requested.