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:

Create Bucket

Let’s call it lefred-mysql-backups:

Create Bucket 2

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

Create PAR

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

PAR details

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:

PAR Urls

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:

MySQL Shell for Visual Studio

DumpInstance() in MySQL Shell for Visual Studio

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:

Object Storage Bucket's Content

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:

Migrate to MySQL HeatWave on OCI

Back up your data and enjoy MySQL and MySQL Shell.