How do I export a database over SSH?

Exporting a database over SSH

Ignas Rimkūnas avatar
Written by Ignas Rimkūnas
Updated over a week ago

In case exporting a database through phpMyAdmin didn't work you can export your database using SSH. Here are the steps:

Step 1 - Preparation

First, you would need to gather your database’s parameters, including the password. If you are not confident in the exact value of your database password - change it.

Step 2 - Connecting

Step 3 - Export

Use this command to export the database:

mysqldump -u database_username -p database_name > file.sql

If the parameters of your database are:

  • MySQL Database name: u123456789_database

  • MySQL Username: u123456789_admin

  • Exported database backup name: backup.sql

The command will look like this:

mysqldump -u u123456789_admin -p u123456789_database > backup.sql

After that you will need to enter the database password - the exporting process will start. When it is completed, a new line will appear:


Keep in mind that the export will take some time depending on the size of your database

That’s it! Now you know how to export your MySQL database 😊


Did this answer your question?