How To Export A Database Via SSH In cPanel

Export a database via SSH for an efficient and reliable way to back up your website’s data, especially when working with large MySQL databases that may time out using phpMyAdmin. With secure shell access, you can use command-line tools like mysqldump and gzip to create fast, compressed backups.

With hosting from Domains.co.za, you get SSH access that streamlines and secures database management.

How To Export A Database Via SSH In cPanel

Follow these steps to export and back up your MySQL database via SSH:

1. Login to your Domains.co.za account.

Export A Database Via SSH In cPanel - Domains.co.za Login Page

2. Open the Manage Services dropdown menu, select your hosting plan from the list, then click Manage next to your domain.

Export A Database Via SSH In cPanel - Manage Services - Web Hosting

3. Click Login next to Control Panel to access cPanel.

Export A Database Via SSH In cPanel - cPanel Control Panel Login

4. In cPanel, go to SSH Access under Security to view instructions for setting up your SSH client.

Export A Database Via SSH In cPanel - cPanel Security Tools

5. Use an SSH client like PuTTY (Windows) or Terminal (macOS/Linux) to connect to your server.

6. Login with your cPanel username and password (or SSH key, if configured). Run the mysqldump command:

mysqldump -u username -p database_name > backup.sql

7. Replace your username with your database user and database_name with your actual database. You’ll be prompted for your password. Optional: Compress the SQL file using gzip for faster storage:

gzip backup.sql

8. This will generate a file called backup.sql.gz.

9. Download the file using SFTP or File Manager in cPanel.

Additional Information

Features of SSH

Not only does it avoid timeouts, which are especially useful for large databases and gives full control over the export process, but it has multiple other features as well.

  • Faster Backups: Command-line tools like mysqldump and gzip are significantly faster than GUI alternatives.
  • Secure Transfers: SSH encrypts your session, keeping your database credentials and data safe.
  • Storage Location: The backup file is saved in your home directory unless you specify another path.
  • Automate it: Use cron jobs to schedule regular exports for automated backups.
  • Check Access: Ensure SSH access is enabled for your hosting account under cPanel’s SSH Access section.
  • Permission Errors: If you encounter issues, verify that the database user has privileges to access the database you’re exporting.
  • Back up Frequently: Regular exports protect you from accidental data loss, hacks, or server failures.

What Our Customers say...