Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Managed Service for MySQL®
  • Getting started
    • All guides
      • Information about existing clusters
      • Creating a cluster
      • Updating a cluster
      • Stopping and starting a cluster
      • Managing cluster hosts
      • Migrating hosts to a different availability zone
      • Managing backups
      • MySQL® version upgrade
      • Deleting a cluster
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Changing the host class
  • Changing the disk type and increasing the storage size
  • Changing MySQL® settings
  • Changing additional cluster settings
  • Moving a cluster
  • Changing security groups
  1. Step-by-step guides
  2. Clusters
  3. Updating a cluster

Updating MySQL® cluster settings

Written by
Yandex Cloud
Updated at May 5, 2025
  • Changing the host class
  • Changing the disk type and increasing the storage size
  • Changing MySQL® settings
  • Changing additional cluster settings
  • Moving a cluster
  • Changing security groups

After creating a cluster, you can:

  • Change the host class.

  • Change the disk type and increase the storage size.

  • Changing MySQL® settings.

    Warning

    You cannot change MySQL® settings using SQL commands.

  • Change additional cluster settings.

  • Move a cluster to another folder.

  • Change security groups.

Learn more about other cluster updates:

  • MySQL® version upgrade.
  • Migrating cluster hosts to a different availability zone.

Changing the host classChanging the host class

The choice of a host class in Managed Service for MySQL® clusters is limited by the CPU and RAM quotas available to DB clusters in your cloud. To check the resources currently in use, open the Quotas page and find Managed Databases.

Note

Some MySQL® settings depend on the selected host class.

When changing the host class:

  • Your single-host cluster will be unavailable for a few minutes with database connections terminated.
  • Your multi-host cluster will get a new master host. Its hosts will be stopped and updated one by one. Once stopped, a host will be unavailable for a few minutes.
  • Using a special FQDN does not guarantee a stable database connection: user sessions may be terminated.

We recommend changing the host class only when the cluster has no active workload.

Management console
CLI
Terraform
REST API
gRPC API
  1. Navigate to the folder dashboard and select Managed Service for MySQL.
  2. Select the cluster and click Edit in the top panel.
  3. To change the class of MySQL® hosts, under Host class, select the required class.
  4. Click Save changes.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To change the host class for the cluster:

  1. View the description of the CLI command to update the cluster:

    yc managed-mysql cluster update --help
    
  2. Request a list of available host classes (the ZONE IDS column specifies the availability zones where you can select the appropriate class):

    yc managed-mysql resource-preset list
    

    Result:

    +-----------+--------------------------------+-------+----------+
    |    ID     |            ZONE IDS            | CORES |  MEMORY  |
    +-----------+--------------------------------+-------+----------+
    | s1.micro  | ru-central1-a, ru-central1-b,  |     2 | 8.0 GB   |
    |           | ru-central1-d                  |       |          |
    | ...                                                           |
    +-----------+--------------------------------+-------+----------+
    
  3. Specify the class in the update cluster command:

    yc managed-mysql cluster update <cluster_name_or_ID>
      --resource-preset <class_ID>
    

    Managed Service for MySQL® will run the update host class command for the cluster.

  1. Open the current Terraform configuration file with an infrastructure plan.

    For more information about creating this file, see Creating clusters.

  2. In the Managed Service for MySQL® cluster description, change the resource_preset_id parameter value under resources:

    resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
      ...
      resources {
        resource_preset_id = "<host_class>"
        ...
      }
    }
    
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see the Terraform provider documentation.

Time limits

A Terraform provider sets the timeout for Managed Service for MySQL® cluster operations:

  • Creating a cluster, including by restoring one from a backup: 15 minutes.
  • Editing a cluster, including the MySQL® version update: 60 minutes.
  • Deleting a cluster: 15 minutes.

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.update method and send the following request, e.g., via cURL:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
        --request PATCH \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://mdb.api.cloud.yandex.net/managed-mysql/v1/clusters/<cluster_ID>' \
        --data '{
                  "updateMask": "configSpec.resources.resourcePresetId",
                  "configSpec": {
                    "resources": {
                      "resourcePresetId": "<host_class>"
                    }
                  }
                }'
    

    Where:

    • updateMask: List of parameters to update as a single string, separated by commas.

      Only one parameter is provided in this case.

    • configSpec.resources.resourcePresetId: New host class.

    You can request the cluster ID with the list of clusters in the folder.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService/Update call and send the following request, e.g., via gRPCurl:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/mdb/mysql/v1/cluster_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "update_mask": {
                "paths": [
                  "config_spec.resources.resource_preset_id"
                ]
              },
              "config_spec": {
                "resources": {
                  "resource_preset_id": "<host_class>"
                }
              }
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.mysql.v1.ClusterService.Update
    

    Where:

    • update_mask: List of parameters to update as an array of paths[] strings.

      Only one parameter is provided in this case.

    • config_spec.resources.resource_preset_id: New host class.

    You can request the cluster ID with the list of clusters in the folder.

  4. View the server response to make sure the request was successful.

Changing the disk type and increasing the storage sizeChanging the disk type and increasing the storage size

Make sure the cloud has enough quota to increase the storage size. Open the cloud's Quotas page and make sure there is space available under Managed Databases in the HDD storage capacity or SSD storage capacity line.

Management console
CLI
Terraform
REST API
gRPC API

To change the disk type and increase the storage size for a cluster:

  1. Navigate to the folder dashboard and select Managed Service for MySQL.

  2. Select the cluster and click Edit in the top panel.

  3. Under Size of storage:

    • Select the disk type.
    • Specify the required disk size.
  4. Click Save changes.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To change the disk type and increase the storage size for a cluster:

  1. View the description of the CLI command to update the cluster:

    yc managed-mysql cluster update --help
    
  2. Specify the disk type and required storage size in the cluster update command (at least as large as disk_size in the cluster properties):

    yc managed-mysql cluster update <cluster_name_or_ID> \
      --disk-type <disk_type> \
      --disk-size <storage_size_in_GB>
    

To change the disk type and increase the storage size for a cluster:

  1. Open the current Terraform configuration file with an infrastructure plan.

    For more information about creating this file, see Creating clusters.

  2. Under resources, change the disk_type_id and disk_size parameter values:

    resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
      ...
      resources {
        disk_type_id = "<disk_type>"
        disk_size    = <storage_size_in_GB>
        ...
      }
    }
    
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see the Terraform provider documentation.

Time limits

A Terraform provider sets the timeout for Managed Service for MySQL® cluster operations:

  • Creating a cluster, including by restoring one from a backup: 15 minutes.
  • Editing a cluster, including the MySQL® version update: 60 minutes.
  • Deleting a cluster: 15 minutes.

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.update method and send the following request, e.g., via cURL:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
        --request PATCH \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://mdb.api.cloud.yandex.net/managed-mysql/v1/clusters/<cluster_ID>' \
        --data '{
                  "updateMask": "configSpec.resources.diskTypeId,configSpec.resources.diskSize",
                  "configSpec": {
                    "resources": {
                      "diskTypeId": "<disk_type>",
                      "diskSize": "<storage_size_in_bytes>"
                    }
                  }
                }'
    

    Where:

    • updateMask: List of parameters to update as a single string, separated by commas.

    • configSpec.resources: Storage parameters:

      • diskTypeId: Disk type.
      • diskSize: New storage size in bytes.

    You can request the cluster ID with the list of clusters in the folder.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService/Update call and send the following request, e.g., via gRPCurl:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/mdb/mysql/v1/cluster_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "update_mask": {
                "paths": [
                  "config_spec.resources.disk_type_id",
                  "config_spec.resources.disk_size"
                ]
              },
              "config_spec": {
                "resources": {
                  "disk_type_id": "<disk_type>",
                  "disk_size": "<storage_size_in_bytes>"
                }
              }
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.mysql.v1.ClusterService.Update
    

    Where:

    • update_mask: List of parameters to update as an array of paths[] strings.

    • config_spec.resources: Storage parameters:

      • disk_type_id: Disk type.
      • disk_size: New storage size in bytes.

    You can request the cluster ID with the list of clusters in the folder.

  4. View the server response to make sure the request was successful.

Changing MySQL® settingsChanging MySQL® settings

Note

Some MySQL® settings depend on the selected host class.

Management console
CLI
Terraform
REST API
gRPC API
  1. Navigate to the folder dashboard and select Managed Service for MySQL.
  2. Select the cluster and click Edit in the top panel.
  3. Configure the MySQL® settings by clicking Settings under DBMS settings.
  4. Click Save.
  5. Click Save changes.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To update the MySQL® settings:

  1. View the description of the CLI command to update the cluster configuration:

    yc managed-mysql cluster update-config --help
    
  2. Set the required parameter values.

    All supported parameters are listed in the request format for the update method, in the mysql_config_5_7 field. To specify a parameter name in the CLI call, convert its name from lowerCamelCase to snake_case. For example, convert the logMinDurationStatement parameter from an API request to log_min_duration_statement for the CLI command:

    yc managed-mysql cluster update-config <cluster_name>
      --set log_min_duration_statement=100,<parameter_name>=<value>,...
    

    Managed Service for MySQL® runs the update cluster settings operation.

  1. Open the current Terraform configuration file with an infrastructure plan.

    For more information about creating this file, see Creating clusters.

  2. In the Managed Service for MySQL® cluster description, add or update the DBMS settings under mysql_config:

    resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
      ...
      mysql_config = {
        <MySQL®_setting_name> = <value>
        ...
      }
    }
    
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see the Terraform provider documentation.

Time limits

A Terraform provider sets the timeout for Managed Service for MySQL® cluster operations:

  • Creating a cluster, including by restoring one from a backup: 15 minutes.
  • Editing a cluster, including the MySQL® version update: 60 minutes.
  • Deleting a cluster: 15 minutes.

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.update method and send the following request, e.g., via cURL:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
        --request PATCH \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://mdb.api.cloud.yandex.net/managed-mysql/v1/clusters/<cluster_ID>' \
        --data '{
                  "updateMask": "configSpec.mysqlConfig_<MySQL®_version>",
                  "configSpec": {
                    "mysqlConfig_<MySQL®_version>": {
                      "<setting_1>": "<value_1>",
                      "<setting_2>": "<value_2>",
                      ...
                      "<setting_N>": "<value_N>"
                    }
                  }
                }'
    

    Where:

    • updateMask: List of parameters to update as a single string, separated by commas.

      Only one parameter is provided in this case.

    • configSpec.mysqlConfig_<MySQL®_version>: MySQL® settings. Use a separate line for each setting; separate them by commas.

      See the method description for the list of MySQL® versions available for the parameter. See Cluster-level DBMS settings for a description and possible values for each setting.

    You can request the cluster ID with the list of clusters in the folder.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService/Update call and send the following request, e.g., via gRPCurl:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/mdb/mysql/v1/cluster_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "update_mask": {
                "paths": [
                  "config_spec.mysql_config_<MySQL®_version>"
                ]
              },
              "config_spec": {
                "mysql_config_<MySQL®_version>": {
                  "<setting_1>": "<value_1>",
                  "<setting_2>": "<value_2>",
                  ...
                  "<setting_N>": "<value_N>"
                }
              }
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.mysql.v1.ClusterService.Update
    

    Where:

    • update_mask: List of parameters to update as an array of paths[] strings.

      Only one parameter is provided in this case.

    • configSpec.mysqlConfig_<MySQL®_version>: MySQL® settings. Use a separate line for each setting; separate them by commas.

      See the method description for the list of MySQL® versions available for the parameter. See Cluster-level DBMS settings for a description and possible values for each setting.

    You can request the cluster ID with the list of clusters in the folder.

  4. View the server response to make sure the request was successful.

For more information on how to update the MySQL® settings, see FAQ.

Changing additional cluster settingsChanging additional cluster settings

Management console
CLI
Terraform
REST API
gRPC API
  1. Navigate to the folder dashboard and select Managed Service for MySQL.

  2. Select the cluster and click Edit in the top panel.

  3. Change additional cluster settings:

    • Backup start time (UTC): Time interval during which the cluster backup starts. Time is specified in 24-hour UTC format. The default time is 22:00 - 23:00 UTC.

    • Retention period for automatic backups, days

      Automatic backups are stored for the specified number of days.

    • Maintenance window: Maintenance window settings:

      • To enable maintenance at any time, select arbitrary (default).
      • To specify the preferred maintenance start time, select by schedule and specify the desired day of the week and UTC hour. For example, you can choose a time when the cluster is least loaded.

      Maintenance operations are carried out both on enabled and disabled clusters. They may include updating the DBMS, applying patches, and so on.

    • DataLens access: Enables you to analyze cluster data in Yandex DataLens.

      For more information about setting up a connection, see Connecting to DataLens.

    • WebSQL access: Enables you to run SQL queries against cluster databases from the Yandex Cloud management console using Yandex WebSQL.

    • Statistics sampling: Enable this option to use the Performance diagnostics tool in the cluster.

    • Deletion protection: Manages cluster protection against accidental deletion.

      Even with cluster deletion protection enabled, one can still delete a user or database or connect manually and delete the database contents.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To change additional cluster settings:

  1. View the description of the CLI command to update the cluster:

    yc managed-mysql cluster update --help
    
  2. Run the following command with the list of settings to update:

    yc managed-mysql cluster update <cluster_name_or_ID> \
      --backup-window-start <backup_start_time> \
      --backup-retain-period-days=<backup_retention_period> \
      --datalens-access=<true_or_false> \
      --websql-access=<true_or_false> \
      --maintenance-window type=<maintenance_type>,`
                          `day=<day_of_week>,`
                          `hour=<hour> \
      --deletion-protection \
      --performance-diagnostics enabled=true,`
                               `sessions-sampling-interval=<session_sampling_interval>,`
                               `statements-sampling-interval=<statement_sampling_interval>
    

You can change the following settings:

  • --backup-window-start: The cluster backup start time, set in UTC format HH:MM:SS. If the time is not set, the backup will start at 22:00 UTC.
  • --backup-retain-period-days: Automatic backup retention period, in days. The possible values range from 7 to 60. The default value is 7.

  • --datalens-access: Enables access from DataLens. The default value is false. For more information about setting up a connection, see Connecting to a MySQL® cluster from DataLens.

  • --websql-access: Enables SQL queries against cluster databases from the Yandex Cloud management console using Yandex WebSQL. The default value is false.

  • --maintenance-window: Maintenance window settings (including for disabled clusters), where type is the maintenance type:

    • anytime (default): Any time.
    • weekly: On a schedule. If setting this value, specify the day of week and the hour:
      • day: Day of week in DDD format: MON, TUE, WED, THU, FRI, SAT, or SUN.
      • hour: Hour (UTC) in HH format: 1 to 24.
  • --deletion-protection: Cluster protection from accidental deletion, true or false.

    Even with cluster deletion protection enabled, one can still delete a user or database or connect manually and delete the database contents.

  • performance-diagnostics: Enabling statistics collection for cluster performance diagnostics. For sessions-sampling-interval and statements-sampling-interval, possible values range from 1 to 86400 seconds.

You can get the cluster name with the list of clusters in the folder.

  1. Open the current Terraform configuration file with an infrastructure plan.

    For more information about creating this file, see Creating clusters.

  2. To change the backup start time, add a backup_window_start block to the Managed Service for MySQL® cluster description:

    resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
      ...
      backup_window_start {
        hours   = <hour>
        minutes = <minute>
      }
      ...
    }
    

    Where:

    • hours: Backup start hour.
    • minutes: Backup start minute.
  3. To change the backup retention period, specify the backup_retain_period_days parameter in the cluster description:

      resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
        ...
        backup_retain_period_days = <backup_retention_period>
        ...
      }
    

    Where backup_retain_period_days is automatic backup retention period, in days. The possible values range from 7 to 60. The default value is 7.

  4. To enable access from DataLens and allow execution of SQL queries from the management console using Yandex WebSQL, add a section named access to the cluster description:

    resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
      ...
      access {
        data_lens = <true_or_false>
        web_sql   = <true_or_false>
        ...
      }
      ...
    }
    
  5. To set up the maintenance window (for disabled clusters as well), add the maintenance_window block to the cluster description:

    resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
      ...
      maintenance_window {
        type = <maintenance_type>
        day  = <day_of_week>
        hour = <hour>
      }
      ...
    }
    

    Where:

    • type: Maintenance type. The possible values include:
      • anytime: Anytime.
      • weekly: By schedule.
    • day: Day of the week for the weekly type in DDD format, e.g., MON.
    • hour: Hour of the day for the weekly type in the HH format, e.g., 21.
  6. To enable cluster protection against accidental deletion by a user of your cloud, add the deletion_protection field set to true to your cluster description:

    resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
      ...
      deletion_protection = <cluster_deletion_protection>
    }
    

    Where deletion_protection is protection against accidental cluster deletion: true or false.

    Even with cluster deletion protection enabled, one can still delete a user or database or connect manually and delete the database contents.

  7. To enable statistics collection for cluster performance diagnostics, add a performance_diagnostics block to your Managed Service for MySQL® cluster description:

    resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
      ...
      performance_diagnostics {
        enabled = true
        sessions_sampling_interval = <session_sampling_interval>
        statements_sampling_interval = <statement_sampling_interval>
      }
      ...
    }
    

    For sessions_sampling_interval and statements_sampling_interval, possible values range from 1 to 86400 seconds.

  8. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  9. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see the Terraform provider documentation.

Time limits

A Terraform provider sets the timeout for Managed Service for MySQL® cluster operations:

  • Creating a cluster, including by restoring one from a backup: 15 minutes.
  • Editing a cluster, including the MySQL® version update: 60 minutes.
  • Deleting a cluster: 15 minutes.

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Create a file named body.json and add the following contents to it:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    {
        "updateMask": "configSpec.backupWindowStart,configSpec.backupRetainPeriodDays,configSpec.access,configSpec.performanceDiagnostics,maintenanceWindow,deletionProtection",
        "configSpec": {
            "backupWindowStart": {
                "hours": "<hours>",
                "minutes": "<minutes>",
                "seconds": "<seconds>",
                "nanos": "<nanoseconds>"
            },
            "backupRetainPeriodDays": "<number_of_days>",
            "access": {
                "dataLens": <access_to_DataLens:_true_or_false>,
                "webSql": <access_to_WebSQL:_true_or_false>,
                "dataTransfer": <access_to_Data_Transfer:_true_or_false>
            },
            "performanceDiagnostics": {
                "enabled": <activate_statistics_collection:_true_or_false>,
                "sessionsSamplingInterval": "<session_sampling_interval>",
                "statementsSamplingInterval": "<statement_sampling_interval>"
            }
        },
        "maintenanceWindow": {
            "weeklyMaintenanceWindow": {
                "day": "<day_of_week>",
                "hour": "<hour>"
            }
        },
        "deletionProtection": <cluster_deletion_protection:_true_or_false>
    }
    

    Where:

    • updateMask: List of parameters to update as a single string, separated by commas.

    • configSpec: Cluster settings:

      • backupWindowStart: Backup window settings.

        In this parameter, specify the backup start time:

        • hours: Between 0 and 23 hours.
        • minutes: Between 0 and 59 minutes.
        • seconds: Between 0 and 59 seconds.
        • nanos: Between 0 and 999999999 nanoseconds.
      • backupRetainPeriodDays: Number of days to retain the cluster backup, between 7 and 60.

      • access: Cluster settings for access to the following Yandex Cloud services:

        • dataLens: Yandex DataLens
        • webSql: Yandex WebSQL
        • dataTransfer: Yandex Data Transfer
      • performanceDiagnostics: Statistics collection settings:

        • enabled: Enables statistics collection.
        • sessionsSamplingInterval: Session sampling interval, from 1 to 86400 seconds.
        • statementsSamplingInterval: Statement sampling interval, from 1 to 86400 seconds.
    • maintenanceWindow: Maintenance window settings (including for disabled clusters). In maintenanceWindow, provide one of the two parameters:

      • anytime: Maintenance can take place at any time.

      • weeklyMaintenanceWindow: Maintenance takes place once a week at the specified time:

        • day: Day of week, in DDD format.
        • hour: Hour, in HH format. The values range from 1 to 24 hours.
    • deletionProtection: Cluster protection from accidental deletion.

      Even with cluster deletion protection enabled, one can still delete a user or database or connect manually and delete the database contents.

  3. Use the Cluster.update method and send the following request, e.g., via cURL:

    curl \
        --request PATCH \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://mdb.api.cloud.yandex.net/managed-mysql/v1/clusters/<cluster_ID>' \
        --data "@body.json"
    

    You can request the cluster ID with the list of clusters in the folder.

  4. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Create a file named body.json and add the following contents to it:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    {
        "cluster_id": "<cluster_ID>",
        "update_mask": {
            "paths": [
                "config_spec.backup_window_start",
                "config_spec.backup_retain_period_days",
                "config_spec.access",
                "config_spec.performance_diagnostics",
                "maintenance_window",
                "deletion_protection"
            ]
        },
        "config_spec": {
            "backup_window_start": {
                "hours": "<hours>",
                "minutes": "<minutes>",
                "seconds": "<seconds>",
                "nanos": "<nanoseconds>"
            },
            "backup_retain_period_days": "<number_of_days>",
            "access": {
                "data_lens": <access_to_DataLens:_true_or_false>,
                "web_sql": <access_to_WebSQL:_true_or_false>,
                "data_transfer": <access_to_Data_Transfer:_true_or_false>
            },
            "performance_diagnostics": {
                "enabled": <activate_statistics_collection:_true_or_false>,
                "sessions_sampling_interval": "<session_sampling_interval>",
                "statements_sampling_interval": "<statement_sampling_interval>"
            }
        },
        "maintenance_window": {
            "weekly_maintenance_window": {
                "day": "<day_of_week>",
                "hour": "<hour>"
            }
        },
        "deletion_protection": <cluster_deletion_protection:_true_or_false>
    }
    

    Where:

    • update_mask: List of parameters to update as an array of paths[] strings.

    • config_spec: Cluster settings:

      • backup_window_start: Backup window settings.

        In this parameter, specify the backup start time:

        • hours: Between 0 and 23 hours.
        • minutes: Between 0 and 59 minutes.
        • seconds: Between 0 and 59 seconds.
        • nanos: Between 0 and 999999999 nanoseconds.
      • backup_retain_period_days: Number of days to retain the cluster backup, between 7 and 60.

      • access: Cluster settings for access to the following Yandex Cloud services:

        • data_lens: Yandex DataLens
        • web_sql: Yandex WebSQL
        • data_transfer: Yandex Data Transfer
      • performance_diagnostics: Statistics collection settings:

        • enabled: Enables statistics collection.
        • sessions_sampling_interval: Session sampling interval, 1 to 86400 seconds.
        • statements_sampling_interval: Statement sampling interval, from 1 to 86400 seconds.
    • maintenance_window: Maintenance window settings (including for disabled clusters). In maintenance_window, provide one of the two parameters:

      • anytime: Maintenance can take place at any time.

      • weekly_maintenance_window: Maintenance takes place once a week at the specified time:

        • day: Day of week, in DDD format.
        • hour: Hour, in HH format. The values range from 1 to 24 hours.
    • deletion_protection: Cluster protection from accidental deletion.

      Even with cluster deletion protection enabled, one can still delete a user or database or connect manually and delete the database contents.

    You can request the cluster ID with the list of clusters in the folder.

  4. Use the ClusterService/Update call and send the following request, e.g., via gRPCurl:

    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/mdb/mysql/v1/cluster_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d @ \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.mysql.v1.ClusterService.Update \
        < body.json
    
  5. View the server response to make sure the request was successful.

Moving a clusterMoving a cluster

Management console
CLI
Terraform
REST API
gRPC API
  1. Navigate to the folder dashboard and select Managed Service for MySQL.
  2. Click to the right of the cluster you want to move.
  3. Select Move.
  4. Select a folder you want to move the cluster to.
  5. Click Move.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To move a cluster:

  1. View the description of the CLI move cluster command:

    yc managed-mysql cluster move --help
    
  2. Specify the destination folder in the move cluster command:

    yc managed-mysql cluster move <cluster_ID> \
       --destination-folder-name=<destination_folder_name>
    

    You can get the cluster ID with the list of clusters in the folder.

  1. Open the current Terraform configuration file with an infrastructure plan.

    For more information about creating this file, see Creating clusters.

  2. In the Managed Service for MySQL® cluster description, edit or add the folder_id parameter value:

    resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
      ...
      folder_id = "<destination_folder_ID>"
    }
    
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see the Terraform provider documentation.

Time limits

A Terraform provider sets the timeout for Managed Service for MySQL® cluster operations:

  • Creating a cluster, including by restoring one from a backup: 15 minutes.
  • Editing a cluster, including the MySQL® version update: 60 minutes.
  • Deleting a cluster: 15 minutes.

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.move method and send the following request, e.g., via cURL:

    curl \
        --request POST \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://mdb.api.cloud.yandex.net/managed-mysql/v1/clusters/<cluster_ID>:move' \
        --data '{
                  "destinationFolderId": "<folder_ID>"
                }'
    

    Where destinationFolderId is the ID of the folder you want to move your cluster to. You can fetch this ID together with the list of folders in the cloud.

    You can request the cluster ID with the list of clusters in the folder.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService/Move call and send the following request, e.g., via gRPCurl:

    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/mdb/mysql/v1/cluster_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "destination_folder_id": "<folder_ID>"
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.mysql.v1.ClusterService.Move
    

    Where destination_folder_id is the ID of the folder you want to move your cluster to. You can fetch this ID together with the list of folders in the cloud.

    You can request the cluster ID with the list of clusters in the folder.

  4. View the server response to make sure the request was successful.

Changing security groupsChanging security groups

Management console
CLI
Terraform
REST API
gRPC API
  1. Navigate to the folder dashboard and select Managed Service for MySQL.
  2. Select the cluster and click Edit in the top panel.
  3. Under Network settings, select security groups for cluster network traffic.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

To edit the list of security groups for your cluster:

  1. View the description of the CLI command to update the cluster:

    yc managed-mysql cluster update --help
    
  2. Specify the security groups in the update cluster command:

    yc managed-mysql cluster update <cluster_name_or_ID> \
      --security-group-ids <list_of_security_group_IDs>
    
  1. Open the current Terraform configuration file with an infrastructure plan.

    For more information about creating this file, see Creating clusters.

  2. In the Managed Service for MySQL® cluster description, change the security_group_ids parameter value:

    resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
      ...
      security_group_ids = [<list_of_security_group_IDs>]
    }
    
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

For more information, see the Terraform provider documentation.

Time limits

A Terraform provider sets the timeout for Managed Service for MySQL® cluster operations:

  • Creating a cluster, including by restoring one from a backup: 15 minutes.
  • Editing a cluster, including the MySQL® version update: 60 minutes.
  • Deleting a cluster: 15 minutes.

Operations exceeding the set timeout are interrupted.

How do I change these limits?

Add the timeouts block to the cluster description, for example:

resource "yandex_mdb_mysql_cluster" "<cluster_name>" {
  ...
  timeouts {
    create = "1h30m" # 1 hour 30 minutes
    update = "2h"    # 2 hours
    delete = "30m"   # 30 minutes
  }
}
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.update method and send the following request, e.g., via cURL:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
        --request PATCH \
        --header "Authorization: Bearer $IAM_TOKEN" \
        --header "Content-Type: application/json" \
        --url 'https://mdb.api.cloud.yandex.net/managed-mysql/v1/clusters/<cluster_ID>' \
        --data '{
                  "updateMask": "securityGroupIds",
                    "securityGroupIds": [
                      "<security_group_1_ID>",
                      "<security_group_2_ID>",
                      ...
                      "<security_group_N_ID>"
                    ]
                }'
    

    Where:

    • updateMask: List of parameters to update as a single string, separated by commas.

      Only one parameter is provided in this case.

    • securityGroupIds: New list of security groups presented in the form of array elements.

    You can request the cluster ID with the list of clusters in the folder.

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService/Update call and send the following request, e.g., via gRPCurl:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
        -format json \
        -import-path ~/cloudapi/ \
        -import-path ~/cloudapi/third_party/googleapis/ \
        -proto ~/cloudapi/yandex/cloud/mdb/mysql/v1/cluster_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>",
              "update_mask": {
                "paths": [
                  "security_group_ids"
                ]
              },
              "security_group_ids": [
                "<security_group_1_ID>",
                "<security_group_2_ID>",
                ...
                "<security_group_N_ID>"
              ]
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.mysql.v1.ClusterService.Update
    

    Where:

    • update_mask: List of parameters to update as an array of paths[] strings.

      Only one parameter is provided in this case.

    • security_group_ids: New list of security groups presented in the form of array elements.

    You can request the cluster ID with the list of clusters in the folder.

  4. View the server response to make sure the request was successful.

Warning

You may need to additionally set up security groups to connect to the cluster.

Was the article helpful?

Previous
Creating a cluster
Next
Stopping and starting a cluster
Yandex project
© 2025 Yandex.Cloud LLC