Back up Your Managed DigitalOcean MySQL Database

SimpleBackups founder

Laurent Lemaire

Co-founder, SimpleBackups

Last update on November 16, 2023
Originally posted on February 27, 2023

Whether you run a website or web application or provide a mobile app to your customers, your databases are critical. They store your website’s content, information about your products or services, and, more importantly, all your customers’ data. The problem is that setting up and maintaining databases can take a lot of time and effort. Luckily, there are some solutions to solve this problem.

A DigitalOcean Managed Database is one of them. In this post, we’ll look at this solution in more detail. More importantly, we’ll show you how to back up your DigitalOcean Managed MySQL Database.

Table of Contents

What Is a DigitalOcean Managed Database?

As the name implies, a DigitalOcean Managed Database is simply a database that’s managed for you.
So, DigitalOcean deals with tasks like database setup, backups, updates scalability and maintenance. In doing so, you get more time to focus on other things like app development, maintenance, and support.

The Problem with DigitalOcean Managed Database Backups

Considering the above, DigitalOcean’s managed databases sound like a convenient option if you’d like to save time and focus on other things besides database management.
The automatic backups sound especially attractive because they’re done daily and, as a bonus, completely free.

There are, however, a few issues:

👎 Storage. A major disadvantage of the backups is that they’re stored in DigitalOcean’s data centers. This presents several problems:

  • For instance, one of the aims of backups is to protect against unanticipated outages. When your backups are stored on the same systems as your main database, you won’t be able to restore your backups if there is such an outage.
  • Also, because the backups are stored on DigitalOcean’s servers, you won’t be able to restore your backups to local or other cloud servers.

👎 Security. Another drawback of these backups is that they’re vulnerable to the same security risks as your main database. So, if your account is compromised, it will impact all your data and backups.

👎 Retention. Finally, while your data is backed up daily, your backups are only retained for seven days. This could pose a significant problem if you’d like backups older than this.



Setting up Your DigitalOcean Managed Database

Before looking at a way to eliminate these challenges, let’s first consider a brief overview of setting up a database and restoring a backup on DigitalOcean.

Creating a DigitalOcean Managed Database

To create a database, go to the Create menu and select Databases. This will take you to the Create a Database page.

On the Create a Database page, you can select the data center region and choose your database’s configuration. In the Choose a data center region section, choose where you’d like to store your database.

In the Choose a database engine section, choose your engine. Here, you’ll choose MySQL.

You’ll then choose your database’s configuration in the Choose a cluster configuration section. Here, you’ll be able to choose your configuration from a list that displays the machine type, the number of database nodes, and its monthly cost.

Finally, once you’ve completed all the sections above, you’ll choose a name for your database cluster in the Finalize and Create section. You’ll also select a project and add tags. In this example, the database’s name is example-database, the project is left as the default, and no tags are added. When done, you can click the Create a Database Cluster button.

Configuring the Database

To manage and configure your database, you’ll first need to connect to it from your local machine. To do this, you’ll first need to obtain your database’s connection details.

You’ll then download your database’s SSL certificate and, once done, connect to your database.

You can connect either with MySQL, the MySQL Shell or through your preferred MySQL GUI (we do like TablePlus). Read here for a more detailed explanation of this process.

Once you’re connected, you can manage your database through your local system’s command line. For the sake of the demonstration, you can also create a basic table and add a few records.

Restoring a Backup of a DigitalOcean Managed Database

When you’d like to restore a backup, select the database you’d like to restore from the Databases page. This will take you to the database’s Overview page, where you click on the Actions button and then choose Restore from backup from the menu.

In the Create a new cluster from a backup window that opens, you can choose to restore the latest backup or choose a backup from a specific day. Once you’ve chosen what you’d like to restore, you can click Restore to New Cluster to start the restoration. Remember, as mentioned earlier, you can’t restore the backup to any other systems, and you can only choose a backup from the previous seven days.



Managing Your DigitalOcean Managed Databases With SimpleBackups

There is a better solution to eliminate these problems – you can use SimpleBackups to manage all your backups in one place. Here are the steps you’ll need to follow to do this.

Getting Started

The first step is to log into your SimpleBackups account. To create a backup, click on Backups in the main menu at the top of the page. This will take you to a page that lists all your backups. Here, you’ll click on Create Backup.

On the next screen, you’ll be able to configure your database backup. So, at the top of the page, ensure that the Databases option is selected.

Choosing a Server

The next option is to choose the server you’d like to use to run the backup. Here, you can choose between Serverless and Own Server. With Serverless, you’ll run the backup using SimpleBackups’ infrastructure, which is ideal if you don’t have a dedicated server or if you’d like to save on storage space.

Conversely, Own Server allows you to run the backup using your own infrastructure. In this case, your server needs access to your database, and you can store your backups locally, off-site, or on mounted volumes. In this example, we’ll choose Own Server.

Choose the Database that Needs to be Backed Up

Next, you’ll choose the database that you’d like to back up. Because it’s a DigitalOcean managed database, you need to activate the Import Managed database (DbaaS) option.

You’ll then click on Connect Provider. On the pop-up that opens, you’ll choose Digital Ocean as the provider and give the account a name. In this example, we’ll name it DO Database. Once done, you can click on Connect DigitalOcean and follow the prompts to connect your account.

Once you’ve connected SimpleBackups to your DigitalOcean account, you can choose the database you’d like to back up from the provided dropdown list. You’ll also select the type of backup you’d like from one of the options.

Finalize and Create the DigitalOcean Backup

To finalize your backup, you’ll:

  • Provide a name. You need to provide a name for your backup to identify it amongst all your other backups. In this example, we’ll name it DO Backup.
  • Pick a schedule. Next, you’ll define how often the backup should run. You can choose between Daily, Weekly, Monthly, On Demand, and Custom. In this example, we’ll choose Daily.
  • Define the retention period. Here, you’ll choose how long you’d like to keep the backup. In the example, we’ll choose 30 days.
  • Select your storage. Finally, you’ll need to choose your storage. Here, we’ll once again use the Dropbox we’ve used in some of our other examples.

Once done, click on Create Backup to create the backup.

Restoring Your Backup

To restore your backup, you’ll choose it from the list of backups. This will take you to the Overview page for your backup.

On this page, you can click on Logs and find the version of the backup that you’d like to restore, and click on the i next to the entry.

In the dialog box that opens, you’ll find the command you can run to restore your backup.



Conclusion

Now that you know how to back up your DigitalOcean Managed Database, you should also know that the service has some serious drawbacks.

Get rid of these drawbacks with an alternative to the DigitalOcean backups. Consider SimpleBackups, which fits the bill perfectly. Get started by creating your first backup today!

Further Reading:

Here are some other resources you can use to learn more about SimpleBackups:



Back to blog

Stop worrying about your backups.
Focus on building amazing things!

Free 7-day trial. No credit card required.

Have a question? Need help getting started?
Get in touch via chat or at [email protected]

Customer support with experts
Security & compliance
Service that you'll love using