All Collections
How do I export a database over SSH on cPanel?
How do I export a database over SSH on cPanel?

Exporting a database over SSH using cPanel

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.

Step 2 - Connecting

  • Connect to your hosting account via SSH.

  • Make sure you are in your desired directory (the database will be exported to your current directory). To navigate between directories use cd and ls commands.

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: user_database

  • MySQL Username: user_admin

And you wish to save the database as backup.sql, then the command will look like this:

mysqldump -u user_admin -p user_database > backup.sql

After that you will need to enter the database password - the exporting process will start. The export will take some time depending on the size of your database. When it is completed, a new line will appear:


This line means that the exporting process is done, you will see your database file appear in File Manager. 😊

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


Did this answer your question?