Database Backup using SSH

In this guide, you’ll learn how to backup database using SSH

You can backup single or multiple databases on a server using SSH. If you are familiar with the SSH terminal then the setup process takes less than 5 minutes.

We will use a WordPress server hosted on DigitalOcean in this example. If you use any server management tool to deploy your server, you can still follow this guide.

For the SSH terminal, you can use any tool. We will use DigitalOcean console access. Most hosting providers have web-based SSH terminals available.


Database backups using SSH require a few command-line tools installed on your SSH server. So review the following guide before you proceed further.

Command-line tools required for database backup using SSH

1. On the integrations, page go to Databases.

2. Click on Setup Database Integration

3. Click on Setup Database Integration

You can use the Public or Private key to connect to your server. In this example, we will use the public key. Enable Use Public Key? toggle. The following table provides details about each field.

NameYesIt's just the custom name you want to set for your integration.
EndpointYesThe endpoint is the server which will actually run your backup and upload data to storage. Choose an endpoint closer to your server location.
Database NameYes (leave it empty if Multi-Database User toggle in ON)Name of the database you want to backup.
Database TypeIt's the type of database server. The most common is MySQL and MariaDB.
Database VersionYesUse the best guess. Our system will automatically adjust it.
Database PortYesPort of your database. By default MariaDB and MySQL it's 3306 and for PostgreSQL, it's 5432
Database Host Name or IPv4 or IPv6YesHostname or IP address of your database.
When connecting using SSH set this to localhost or IP of your database if it's on another server.
Database UserYesThe user of database login. This user will be used for backup using mysqldump pr pg_dump
Database PasswordOptionalThe password of the database user. Leave empty if your user doesn't require a password.
Use Our Public Key?OptionalUse a public key to connect to your database server.
Use Your Private Key?OptionalUse a private key to connect to your database server.
SSH Server Hostname or IPv4 or IPv6YesThis is the public hostname or IP address of your server.
SSH Server PortYesYour server SSH port. By default, it's mostly 22
SSH UserYesSSH user to login into SSH terminal. A public/private key will be added for this user.
Multi-Database User?OptionalIf the database user can access multiple databases then you can use this option to use one integration to create multiple integrations. When you enable this then make the Database Name field empty.

You can find most of the details in your wp-config.php file if you are using WordPress.

4. Copy the public key shown in the first purple box.