This page describes how to upgrade the minor version of a MySQL instance. For supported versions, see Database versions and version policies.
Note: To upgrade the major version of a database, see Upgrade the database major version by migrating data or Upgrade the database major version in-place.With each new minor version, database providers release new features, security patches, bug fixes, and performance improvements. Additionally, Cloud SQL regularly updates your minor version during maintenance.
However, MySQL 8.0 doesn't support downgrading. As such, minor version upgrades aren't automatically included with routine maintenance. You can specify the minor version for Cloud SQL for MySQL 8.0 while creating an instance or later through an upgrade process, both of which are described on this page.
Before upgrading to a new MySQL 8.0 minor version, familiarize yourself with the changes. See MySQL 8.0 Release Notes. If you use Cloud SQL for MySQL 5.6 or 5.7, Cloud SQL automatically manages your instance's minor version. When you provision a new instance, Cloud SQL automatically configures your instance with the latest database version available. During routine maintenance, Cloud SQL automatically upgrades your instance to the latest supported version.
To upgrade the database minor version of your MySQL 8.0 instance, you need to update the instance with your preferred minor version, which must be greater than the installed minor version. You can't revert to an unspecified minor version after an instance has been provisioned.
If you're running a Cloud SQL Enterprise Plus edition instance, then the minor version upgrade completes with near-zero downtime.
Before you upgradeCloud SQL supports minor version upgrade for MySQL 8.0 instances. MySQL 8.0 doesn't allow downgrades. So, before you upgrade your primary instance, follow these steps to ensure that your data is safe.
Choose the target minor version of the database.
gcloudFor information about installing and getting started with the gcloud CLI, see Install the gcloud CLI. For information about starting Cloud Shell, see Use Cloud Shell.
To check which minor versions of the database are available for an in-place upgrade, do the following:
gcloud sql instances describe INSTANCE_NAME
Replace INSTANCE_NAME with the name of the instance.
upgradableDatabaseVersions
.name
: the database version string that includes the database major and minor version that you can target for the Cloud SQL for MySQL minor version in-place upgrade.To check which minor versions of the database are available for an in-place upgrade, use the instances.get
method of the Cloud SQL Admin API.
Before using any of the request data, make the following replacements:
HTTP method and URL:
GET https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_NAME
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Execute the following command:
curl -X GET \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_NAME"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_NAME" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
upgradableDatabaseVersions: { major_version: "MYSQL_8_0" name: "MYSQL_8_0_36" display_name: "MySQL 8.0.36" }REST v1beta4
To check which minor versions of the database are available for an in-place upgrade, use the instances.get
method of the Cloud SQL Admin API.
Before using any of the request data, make the following replacements:
HTTP method and URL:
GET https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/instances/INSTANCE_NAME
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Execute the following command:
curl -X GET \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/instances/INSTANCE_NAME"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/instances/INSTANCE_NAME" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
upgradableDatabaseVersions: { major_version: "MYSQL_8_0" name: "MYSQL_8_0_36" display_name: "MySQL 8.0.36" }
For the complete list of the database versions that Cloud SQL supports, see Database versions and version policies.
Test your upgrade in a staging environment.
Create a clone of your production instance to serve as a staging instance. This creates a new database instance, with the same major and minor versions.
Perform a minor version upgrade on the staging instance.
Run workload tests to verify that the upgrade was successful and that your application performs as expected. When testing is successful, proceed to upgrade your read replica instances.
Upgrade your read replica instances.
Upgrade all read replicas in the database to the target minor version.
Verify that your application works as expected.
Back up your primary instance.
As with any significant database update, make a backup of your primary instance.
You can specify the database minor version of an existing instance by using gcloud
or the REST API. Perform minor version upgrades at a time when the database isn't in use. If your instance requires a restart, then as a result, your instance experiences some downtime. Cloud SQL Enterprise Plus edition instances experience near-zero downtime. If the installed version is higher than the requested version, then the request is rejected.
Use the gcloud sql instances patch
command with the --database-version
flag.
Replace the following variables before running the command:
gcloud sql instances patch INSTANCE_NAME \ --database-version=DATABASE_VERSIONREST v1
Use a PATCH request with the instances:patch method and the databaseVersion
flag.
Before using any of the request data, make the following replacements:
HTTP method and URL:
PATCH https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_ID
Request JSON body:
{ "databaseVersion": "DATABASE_VERSION" }
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
curl -X PATCH \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_ID"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_ID" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "kind": "sql#operation", "targetLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/instances/INSTANCE_ID", "status": "PENDING", "user": "user@example.com", "insertTime": "2022-07-17T20:23:15.540Z", "operationType": "UPDATE", "name": "fa3f7304-ccf6-4d2f-a6f5-24df00000032", "targetId": "INSTANCE_ID", "selfLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/operations/fa3f7304-ccf6-4d2f-a6f5-24df00000032", "targetProject": "PROJECT_ID" }REST v1beta4
Use a PATCH request with the instances:patch method and the databaseVersion
flag.
Before using any of the request data, make the following replacements:
HTTP method and URL:
PATCH https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT-ID/instances/INSTANCE_ID
Request JSON body:
{ "databaseVersion": "DATABASE_VERSION" }
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell) Note: The following command assumes that you have logged in to thegcloud
CLI with your user account by running gcloud init
or gcloud auth login
, or by using Cloud Shell, which automatically logs you into the gcloud
CLI . You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
curl -X PATCH \PowerShell (Windows) Note: The following command assumes that you have logged in to the
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT-ID/instances/INSTANCE_ID"
gcloud
CLI with your user account by running gcloud init
or gcloud auth login
. You can check the currently active account by running gcloud auth list
.
Save the request body in a file named request.json
, and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT-ID/instances/INSTANCE_ID" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "kind": "sql#operation", "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/instances/INSTANCE_ID", "status": "PENDING", "user": "user@example.com", "insertTime": "2022-07-17T20:23:15.540Z", "operationType": "UPDATE", "name": "fa3f7304-ccf6-4d2f-a6f5-24df00000032", "targetId": "INSTANCE-ID", "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/operations/fa3f7304-ccf6-4d2f-a6f5-24df00000032", "targetProject": "PROJECT_ID" }Check the database minor installed version
When you view the instance summary information, the database minor installed version is visible in the Configuration section.
Roll back an upgradeWhile testing an upgrade, if you notice an issue, you might want to roll back your database to recover the database instance running the previous minor version.
To restore a pre-upgrade backup, complete the following steps:
As an alternative to restoring a backup, perform a point-in-time recovery and create a new instance.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4