Restore a deleted Azure Database for MySQL - Flexible Server instance

APPLIES TO: Azure Database for MySQL - Flexible Server

When an Azure Database for MySQL flexible server instance is deleted, the server backup can be retained for up to five days in the service. The server backup can be accessed and restored only from the Azure subscription where the server initially resided. The following recommended steps can be followed to recover a deleted Azure Database for MySQL flexible server resource within five days from the time of server deletion. The recommended steps work only if the backup for the server is still available and not deleted from the system.

Prerequisites

To restore a deleted Azure Database for MySQL flexible server instance, you need the following:

  • Azure Subscription name hosting the original server
  • Location where the server was created

Steps to restore

  1. Go to the Activity Log from the Monitor page in Azure portal.

  2. In the Activity Log, select Add filter as shown and set the following filters for the

    • Subscription = Your Subscription hosting the deleted server
    • Resource Type = Azure Database for MySQL flexible servers (Microsoft.DBforMySQL/flexibleServers)
    • Operation = Delete MySQL Server (Microsoft.DBforMySQL/flexibleServers/delete)

    [ Screenshot of Activity Log filtered for delete MySQL server operation. ]

  3. Select the Delete MySQL Server event, select the JSON tab, and note the "resourceId" and "submissionTimestamp" attributes in JSON output. The resourceId is in the following format: /subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TargetResourceGroup/providers/Microsoft.DBforMySQL/flexibleServers/deletedserver.

  4. Use Create Server REST API.

  5. The following is Request Body section:

    {
        "location": "Dropped Server Location",
        "properties":
            {
                "restorePointInTime": "submissionTimestamp - 15 minutes",
                "createMode": "PointInTimeRestore",
                "sourceServerResourceId": "resourceId"
            }
    }
    
  6. Replace the following values in the above request body:

    • "Dropped server Location" with the Azure region where the deleted server was created
    • "submissionTimestamp", and "resourceId" with the values captured in Step 3.
    • For "restorePointInTime", specify a value of "submissionTimestamp" minus 15 minutes to ensure the command doesn't error out.
  7. If you see Response Code 201 or 202, the restore request is successfully submitted.

  8. The server creation can take time depending on the database size and compute resources provisioned on the original server. The restore status can be monitored from

Activity log by filtering for:

  • Subscription = Your Subscription
  • Resource Type = Azure Database for MySQL flexible servers (Microsoft.DBforMySQL/flexibleServers)
  • Operation = Update MySQL Server Create

Next step