Skip to main content
All CollectionscPanelMySQL
How to Export a Database over SSH on cPanel
How to Export a Database over SSH on cPanel

Exporting a database over SSH using cPanel

Updated over a year ago

If you encountered difficulties exporting a database through phpMyAdmin, you can export your database using SSH. Just follow these steps:

Step 1 - Preparation

Step 2 - Connecting via SSH

  • Connect to your hosting via SSH

  • Use the ls command to ensure you are in the root directory, that is, public_html. If you are in a different directory, use the ls and cd commands to navigate to the correct location

Step 3 - Export the Database

Use this command to export the database:

mysqldump -u database_username -p database_name > file.sql

For example, if the parameters of your database are:

  • MySQL Database name: user_database

  • MySQL Username: user_admin

  • Uploaded database file: backup.sql

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:

-bash-4.2$

This line means that the exporting process is done. You can verify that your database file is available on the location using the File Manager.

Did this answer your question?