< All Topics
   

Here is how to export a databases via SSH and why it is the most efficient way to create a full database backup, especially for large or complex websites. It avoids browser timeouts and provides a clean SQL file ready for migration or restoration.

This guide explains how to export a MySQL database securely using SSH on Hosted.com®.

When Should You Export a Databases via SSH?

Exporting via SSH is ideal when:

  • Your database is too large for phpMyAdmin.
  • You’re migrating a website to another server.
  • You need a full, uncompressed SQL backup.
  • You want faster and more reliable exports.

Requirements:

Before starting, ensure:

  • SSH access is enabled on your Hosted.com® hosting plan.
  • You have your database name and database user details.
  • You can access your hosting account via cPanel.

How To Export A Databases Via SSH In cPanel

Step 1: Connect to Your Server via SSH

Open your SSH client and connect using:

ssh username@yourdomain.co.za

Enter your cPanel password when prompted.

Step 2: Export the Database

Use the mysqldump command:

mysqldump -u database_user -p database_name > backup.sql
EXAMPLE:
mysqldump -u myuser_wp -p mydatabase_wp > site_backup.sql
  • Press Enter.
  • Enter the database user password.
  • The export will begin immediately.

Large databases may take a few minutes to complete.

Step 3: Confirm the Export

Once complete, check the file exists:

ls

You should see your .sql file listed in the directory.

Step 4: Download the Database File

1. Login to cPanel.

2. Open File Manager.

3. Locate the exported .sql file.

4. Download it to your local computer.

Additional Information

  • Exporting a database via SSH creates a complete, server-side snapshot of your database structure and data, ensuring better reliability and accuracy compared to browser-based exports, especially for dynamic or frequently updated websites.
  • The mysqldump utility exports both table schemas and data in a format which is universally compatible with MySQL and MariaDB servers, making the exported file ideal for migrations, disaster recovery, or cloning environments.
  • For large or mission-critical websites, exporting databases during periods of low traffic is recommended, as active write operations during the export process may result in minor data inconsistencies in highly transactional applications.
  • Compressed exports using gzip significantly reduces file size, which not only saves storage space but also speeds up downloads and future imports, particularly when transferring backups between servers or storing them offsite.
  • Keeping multiple dated database backups allows you to roll back to a specific point in time if data corruption, accidental deletion, or application errors occur, making regular SSH exports an essential part of a sound backup strategy.
  • After downloading the exported database to your local machine or external backup location, deleting the SQL or compressed backup file from your hosting account helps maintain server security and prevents unnecessary disk usage.
  • You can automate this mysqldump command using a Cron Job in cPanel to create regular, scheduled database backups for reliable point-in-time recovery.

Login to Hosted.com® Account

1. Go to the Hosted.com® website Account Login page.

2. Enter your Email and Password and click the Sign In button.

How To Export A Databases Via SSH In cPanel - Hosted.com® Sign In Webpage

3. You will see the Hosted.com® Dashboard, displaying the Manage Account menu on the left and your Account Information, Account Overview and Open Support Tickets on the right.

Hosted.com® Dashboard Manage Services

Login to cPanel from your Hosted.com® Dashboard

4. Click on Manage Services to view the sub-dropdown menu and select the hosting package for the domain you want to work with – in our example we are using WordPress Hosting.

5. Click the Manage button to the right of the domain name you want to access.

Hosted.com® Dashboard WordPress Hosting

6. The display will now show Product Information, Quick Manage, Resource Usage and Site Statistics for that domain name.

Hosted.com® Dashboard Manage Services

7. Under Product Information, scroll down to Control Panel, which will display cPanel to the right, and click on the Login button.

Hosted.com® cPanel Dashboard

8. The cPanel Dashboard will now be displa

Was this article helpful?
Please Share Your Feedback
How Can We Improve This Article?