Backup and Restore MySQL Database Using mysqldump

http://www.thegeekstuff.com/2008/09/backup-and-restore-mysql-database-using-mysqldump/

 

mysqldump is an effective tool to backup MySQL database. It creates a *.sql file withDROP tableCREATE table and INSERT intosql-statements of the source database. To restore the database,  execute the *.sql file on destination database.  For MyISAM, usemysqlhotcopy method that we explained earlier, as it is faster for MyISAM tables.

Using mysqldump, you can backup a local database and restore it on a remote database at the same time, using a single command. In this article, let us review several practical examples on how to use mysqldump to backup and restore.

For the impatient, here is the quick snippet of how backup and restore MySQL database using mysqldump:

backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql


...
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s