This tutorial explains how to backup and restore a database using secure shell (SSH) as opposed to Cpanel or PHPMyadmin. SSH (Secure Shell) can be used in Windows via 3rd party apps like Putty or in OSX via native Terminal App.
To backup your database through SSH (create SQL dump):
mysqldump --opt -u user -p dbname > {path}/backup.sql
Replace user with the db username and dbname with the database name. Replace {path} with the path where you want your DB dump to sit. Example:
mysqldump –opt – u root – p magentodatabase > usr/var/backups/aprilbackup.sql
You’ll be prompted for the database password as soon as you run the command. Enter the password and hit enter.
To restore:
mysql -u user -p dbname < {path}/backup.sql