You can call the ModifyParameter operation to modify the parameters of an instance.

You can modify the parameters directly or by using a parameter template. After you submit the parameter modification request, ApsaraDB RDS starts a task to apply the new parameter values to the instance. If a new parameter value takes effect only after the instance restarts, ApsaraDB RDS restarts the instance. For information about configurable parameters, see Configure the parameters of an ApsaraDB RDS for MySQL instance.

Note Before a parameter modification task is run, ApsaraDB RDS checks whether the parameters exist, whether they are configurable, and whether the new parameter values are valid.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyParameter

The operation that you want to perform. Set the value to ModifyParameter.

ClientToken String No ETnLKlblzczshOTUbOCzxxxxxxxxxx

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that the generated token is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length.

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance.

Parameters String Yes {"delayed_insert_timeout":"600","max_length_for_sort_data":"2048"}

The JSON strings of parameters and their values. All the parameter values are of the string type. Format: {"Parameter name 1":"Parameter value 1","Parameter name 2":"Parameter value 2"...}. You can call the DescribeParameterTemplates operation to query parameter names and values.

Note If you specify this parameter, you do not need to specify the ParameterGroupId parameter.
Forcerestart Boolean No false

Specifies whether to restart the instance for a new parameter value to take effect. Valid values:

  • true: The system forcefully restarts the instance. If a new parameter value takes effect only after the instance restarts, you must set this parameter to true. Otherwise, the new parameter value cannot take effect.
  • false: The system does not forcefully restart the instance.

Default value: false

ParameterGroupId String No rpg-xxxxxxxxx

The ID of the parameter template.

Note
  • If you specify this parameter, you do not need to specify the Parameters parameter.
  • If the parameter template can be applied only after the instance is restarted, you must specify the Forcerestart parameter.
SwitchTimeMode String No ScheduleTime

The time at which the modification takes effect. Valid values:

  • Immediately: immediately modifies the parameter. This is the default value.
  • MaintainTime: modifies the parameter during the maintenance window of the instance. You can call the ModifyDBInstanceMaintainTime operation to change the maintenance window of the instance.
  • ScheduleTime: The modification takes effect at the point in time that you specify. If you specify this value, you must also specify the SwitchTime parameter.
SwitchTime String No 2022-05-06T09:24:00Z

The time at which the modification takes effect. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Note This time must be later than the time at which you call this operation.

Response parameters

Parameter Type Example Description
RequestId String 542BB8D6-4268-45CC-A557-B03EFD7AB30A

The ID of the request.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=ModifyParameter
&DBInstanceId=rm-uf6wjk5xxxxxxx
&Parameters={"delayed_insert_timeout":"600","max_length_for_sort_data":"2048"}
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyParameterResponse>
       <RequestId>542BB8D6-4268-45CC-A557-B03EFD7AB30A</RequestId>
</ModifyParameterResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "542BB8D6-4268-45CC-A557-B03EFD7AB30A"
}

Error codes

HTTP status code Error code Error message Description
400 PendingActionOverdue the action execution time is already overdue The error message returned because the time that you specified for the modification to take effect has elapsed.
400 InvalidParameters.Format Specified parameters is not valid. The error message returned because the value of a specified parameter is invalid.
400 InvalidParameters.Format The format of the specified parameter is invalid. The error message returned because the format of a specified parameter is invalid.
400 Invalid.ParamGroupDBCategory ParamGroup category is basic, not standard. The error message returned because the category of the specified parameter template is basic instead of standard.
403 IncorrectDBInstanceType The current database instance type does not support the operation. The error message returned because the configuration of the instance does not support this operation.
403 IncorrectDBInstanceState The current database status does not support the operation. The error message returned because the status of the instance does not support this operation. Check that the instance is in the Running state.
403 Invalid.Parameter Specified parameters is not valid. The error message returned because a specified parameter is invalid.
404 InvalidDBInstance.NotFound The specified instance does not exist or is not supported. The error message returned because the specified instance is not found. Check the ID of the instance.

For a list of error codes, visit the API Error Center.