How to backup and restore a database via SSH with the MySQL CLI

Run the following command:

mysqldump -u root -p databasename > backupfilename.sql

to backup a database.


To restore a database,

mysql -u root -p databasename < backupfilename.sql

will be the command to use.


You will be prompted for the password after running this command before any results are achieved. 

This article has been provided by Codero Hosting, the leading provider of reliable dedicated, managed and cloud hosting services. Need more information on this topic or to learn more about Codero’s hosting services please visit 
www.codero.comchat with us online or give us a call at 866-2-CODERO. 

Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)