Backup and restore mysql databases on the shell

Thursday, August 13, 2009 posted by admin

One way to create a backup of a mysql database on the shell is to use the mysqldump command. Mysqldump creates a dump of the database in form of sql commands.

Backup

mysqldump -u root -p mydatabase > /tmp/backup_mydatabase.sql

This command creates a backup of the database with the name “mydatabase” in the file /tmp/backup_mydatabase.sql

Restore

To restore the backup, use the command:

mysql -u root -p mydatabase < /tmp/backup_mydatabase.sql

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Twitter
  • FriendFeed
  • MisterWong
  • StumbleUpon


Leave a Reply