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 then 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.
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.
It's just the custom name you want to set for your integration.
The endpoint is the server which will actually run your backup and upload data to storage. Choose an endpoint closer to your server location.
Yes (leave it empty if Multi-Database User toggle in ON)
Name of the database you want to backup.
It's the type of database server. The most common is MySQL and MariaDB.
Use the best guess. Our system will automatically adjust it.
Port of your database. By default MariaDB and MySQL it's 3306 and for PostgreSQL, it's 5432
Database Host Name or IPv4 or IPv6
Hostname 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.
The user of database login. This user will be used for backup using mysqldump pr pg_dump
The password of the database user. Leave empty if your user doesn't require a password.
Use Our Public Key?
Use a public key to connect to your database server.
Use Your Private Key?
Use a private key to connect to your database server.
SSH Server Hostname or IPv4 or IPv6
This is the public hostname or IP address of your server.
SSH Server Port
Your server SSH port. By default, it's mostly 22
SSH user to login into SSH terminal. A public/private key will be added for this user.
If 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.
5. Goto your DigitalOcean server page.
6. Click on the console link in the top menu.
6. Paste the public key you copied in your integration settings box.
If you get an error make sure the .ssh directory is created by running the following commands and then paste the public key again.
chmod 0600 ~/.ssh/authorized_keys
7. Add integration and wait for the success message.
8. Create a database node.
9. Configure database node.
You have the option to backup specific tables or backup all tables. Name your node and click on Create Node button
10. Configure database node.
That's it. Now you can create on-demand backups and add schedules to create automated backups.