How do I back up and restore an SQL database from a command line using SSH? Print

  • 1

How to back up a mySQL database using SSH Telnet:

Log into your account on our server and issue the following command:

[This is all one command line!]

/usr/bin/mysqldump $databasename -u $user -p$password > /home/$user/file.dump


$ indicates a variable, so instead of entering $user, you'll enter your actual user name for your account. Your mySQL username and password are usually the same as the ones that you use to access your control panel.

For example, your actual command might look like this:

/usr/bin/mysqldump joescars_com -u frankie -p18circ > /home/frankie/joesbackup.sql



How to restore a mySQL database using SSH:


Log into your account on our server and issue the following command:

[This is all one command line!]

mysql $databasename -u $user -p$password < /home/$user/file.dump


Was this answer helpful?

« Back