Backup or restore MySQL database via SSH or terminal.

Here is the command to use to actually backup the database on the command line:

mysqldump --add-drop-table -u user -p database > database.sql

When you have the backup, use this command to restore it:

mysql -u user -p database < database.sql

You need to make the appropriate substitutions obviously. Hope this is brief enough!

This entry was posted in Programming, Webhosting and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.