Backup / Export a Database from SSH
In this tutorial we will show you how to export a database from SSH. This is useful for many things such as when you are moving your site, since it exports the entire database, or before you attempt to upgrade a website, since it is essentially a backup of the database.
Generate a Database Backup:
- Connect to your server via SSH.
- In the command line enter the following code:
mysqldump -u dbusername -p databasename > nameofdbbackup.sqlBe sure to replace:
dbusername = with the database username for the database you want to export.
databasename = with the name of the database you want to export.
nameofdbbackup = enter a name for the exported database.
- Hit the Enter key and it will ask you for your password. Type your password and hit the Enter key again, it will begin exporting, this may take some time to complete, depending how large your database is. Your SSH client will take you to a new line when this process completes.
The database will now be available for download in your home directory.
Congratulations, now you know how to Export / Backup your database from SSH!
Did you find this article helpful?
We value your feedback!
Why was this article not helpful? (Check all that apply)The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
new! - Enter your name and email address above and we will post your feedback in the comments on this page!
Like this Article? Tweet
Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!