Backup your MySQL instance to the Cloud

Since MySQL Shell 8.1, it’s even easier to create a logical backup of your MySQL instance and store it directly in Object Storage, an internet-scale, high-performance storage platform in Oracle Cloud Infrastructure (OCI).

MySQL Shell now offers the option of dumping to Object Storage Bucket using PAR (Pre-Authenticated Request).

Bucket Creation

The first step is to create an Object Storage Bucket in the OCI Console:

Let’s call it lefred-mysql-backups:

When created, we can click on the three-dots and create a new PAR:

It’s important to allow reads and writes. We also need to enable the listing of the objects:

Please note that the PAR url is only displayed once. You currently have two urls. We’re going to use the new one, so we need to select it and copy it:

MySQL Shell

Now we will use the created PAR to store our logical dump directly to OCI Object Storage form MySQL Shell.

We can use MySQL Shell (command line utility) or MySQL Shell for Visual Studio Code. But to work as expected, don’t forget we should use MySQL Shell 8.1 or more recent.

When connected to our MySQL Instance, we use the dumpInstance() utility following the syntax below:

JS> util.dumpInstance(PAR_URL, options)

Example on Visual Studio Code:

You can get the list of options from the manual.

I recommend to add some suffix to the PAR url. For example I use something like /host/date/:

JS> util.dumpInstance("https://xxxxx.objectsorage.xxxx/dell/2023-10-20/",
       {compatibility: ["strip_invalid_grants"])

Object Storage

The backup is listed in the Object Storage Bucket:

The file @.json contains all the important information related to the dump.

Conclusion

The new MySQL Shell makes it even easier to store logical data in the cloud.

It’s a great option for storing and backing up your data offsite and keep it safe.

Of course, this dump can also be used to migrate effortlessly to MySQL HeatWave.

Back up your data and enjoy MySQL and MySQL Shell.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

As MySQL Community Manager, I am an employee of Oracle and the views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

You can find articles I wrote on Oracle’s blog.