tencent cloud

TencentDB for MySQL

Instance Management

Download
Focus Mode
Font Size
Last updated: 2026-10-08 11:56:00
AI-Translated
API
Description
ModifyInstanceParam
Modifies the instance parameters
CloseWanService
Disable public network access for the instance.
OpenWanService
Enable public network access for the instance.
RestartDBInstances
Restarting an Instance
OpenDBInstanceGTID
Enable GTID for the instance.
ModifyDBInstanceName
Modify the cloud database instance name.
ModifyDBInstanceProject
Modify the project to which the cloud database instance belongs.
ModifyDBInstanceVipVport
Modify the IP address and port number of the cloud database instance.
DescribeDBInstanceCharset
Query the character set of the cloud database instance.
DescribeDBInstanceConfig
Query the configuration information of the cloud database instance.
DescribeDBInstanceGTID
Query whether GTID is enabled for a cloud database instance.
DescribeDBInstanceRebootTime
Query the estimated restart time of the cloud database instance.

ModifyInstanceParam: Modifying Instance Parameters

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module
import logging
import traceback
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The input parameters must include the Tencent Cloud account secretId and secretKey.
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object for the product to be requested, for example, cdb.
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object.
req = models.ModifyInstanceParamRequest()
req.InstanceIds = ["cdb-1y6g3zj8","cdb-7ghaiocc"]
req.ParamList = [{"name":"max_connections","currentValue":"100"},{"name":"character_set_server","currentValue":"utf8"},{"name":"lower_case_table_names","currentValue":"1"}]
#req.ParamList = [{"name":"max_connections","currentValue":"100"}]
#param = models.Parameter()
#param.Name = "max_connections"
#param.CurrentValue = "1000"
#req.ParamList = [param]


print req
# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.ModifyInstanceParam(req)

# Output the response packet as a json string.
print(resp.to_json_string())
except TencentCloudSDKException as err:
msg = traceback.format_exc() # Method 1
print (msg)


CloseWanService: Disabling Public Network Access for an Instance

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The input parameters must include the Tencent Cloud account secretId and secretKey.
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object for the product to be requested, for example, cdb.
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.CloseWanServiceRequest()
req.InstanceId = "cdb-1y6g3zj8"

# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.CloseWanService(req)

# Output the response packet as a json string.
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)


OpenWanService: Enabling Public Network Access for an Instance

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The input parameters must include the Tencent Cloud account secretId and secretKey.
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object for the product to be requested, for example, cdb.
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.OpenWanServiceRequest()
req.InstanceId = "cdb-1y6g3zj8"

# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.OpenWanService(req)

# Output the response packet as a json string.
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)

RestartDBInstances: Restarting an Instance

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The input parameters must include the Tencent Cloud account secretId and secretKey.
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object for the product to be requested, for example, cdb.
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.RestartDBInstancesRequest()
req.InstanceIds = ["cdb-7ghaiocc"]

# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.RestartDBInstances(req)

# Output the response packet as a json string.
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)

OpenDBInstanceGTID: Enabling GTID for an Instance

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The input parameters must include the Tencent Cloud account secretId and secretKey.
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object for the product to be requested, for example, cdb.
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.OpenDBInstanceGTIDRequest()
req.InstanceId = "cdb-7ghaiocc"


# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.OpenDBInstanceGTID(req)

# Output the response packet as a json string.
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)


ModifyDBInstanceName: Modifying the Name of a Cloud Database Instance

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The input parameters must include the Tencent Cloud account secretId and secretKey.
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object for the product to be requested, for example, cdb.
client = cdb_client.CdbClient(cred, "ap-beijing")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.ModifyDBInstanceNameRequest()
req.InstanceId = "cdb-cukm86n2"
req.InstanceName = "1s Chinese"

# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.ModifyDBInstanceName(req)

# Output the response packet as a json string.
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)

ModifyDBInstanceProject: Modifying the Project of a Cloud Database Instance


#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module
import logging
import traceback
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models


def DescribeDBInstancesList():
try:
# Instantiate an authentication object. The input parameters must include the Tencent Cloud account secretId and secretKey.
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object for the product to be requested, for example, cdb.
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.ModifyDBInstanceProjectRequest()
req.InstanceIds = ["cdb-7ghaiocc"]
req.NewProjectId =1


# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.ModifyDBInstanceProject(req)

# Output the response packet as a json string.
print(resp.to_json_string())
except TencentCloudSDKException as err:
msg = traceback.format_exc() # Method 1
print (msg)



DescribeDBInstancesList()



ModifyDBInstanceVipVport: Modifying the IP address and Port of a Cloud Database Instance


#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module
import logging
import traceback
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The input parameters must include the Tencent Cloud account secretId and secretKey.
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object for the product to be requested, for example, cdb.
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.ModifyDBInstanceVipVportRequest()
req.InstanceId = "cdb-7ghaiocc"
req.DstIp = "10.0.0.13"
req.DstPort =1025
req.UniqVpcId = vpc-xxxx

# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.ModifyDBInstanceVipVport(req)

# Output the response packet as a json string.
print(resp.to_json_string())
except TencentCloudSDKException as err:
msg = traceback.format_exc() # Method 1
print (msg)


DescribeDBInstanceCharset: Querying the Character Set of a Cloud Database Instance

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The input parameters must include the Tencent Cloud account secretId and secretKey.
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object for the product to be requested, for example, cdb.
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.DescribeDBInstanceCharsetRequest()
req.InstanceId = "cdb-1y6g3zj8"


# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.DescribeDBInstanceCharset(req)

# Output the response packet as a json string.
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)


DescribeDBInstanceConfig: Querying the Configuration of a Cloud Database Instance

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The input parameters must include the Tencent Cloud account secretId and secretKey.
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object for the product to be requested, for example, cdb.
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.DescribeDBInstanceConfigRequest()
req.InstanceId = "cdb-1y6g3zj8"


# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.DescribeDBInstanceConfig(req)

# Output the response packet as a json string.
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)


DescribeDBInstanceGTID: Querying Whether GTID Is Enabled for a Cloud Database Instance

#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The input parameters must include the Tencent Cloud account secretId and secretKey.
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object for the product to be requested, for example, cdb.
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.DescribeDBInstanceGTIDRequest()
req.InstanceId = "cdb-1y6g3zj8"


# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.DescribeDBInstanceGTID(req)

# Output the response packet as a json string.
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)


DescribeDBInstanceRebootTime: Querying the Estimated Reboot Time of a Cloud Database Instance


#!/usr/bin/python
# -*- coding: utf-8 -*-

# Import the TencentCloud API entry module

from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdb.v20170320 import cdb_client, models

try:
# Instantiate an authentication object. The input parameters must include the Tencent Cloud account secretId and secretKey.
cred = credential.Credential("secretId", "secretKey")

# Instantiate the client object for the product to be requested, for example, cdb.
client = cdb_client.CdbClient(cred, "ap-shanghai")

# Instantiate a request object: req = models.ModifyInstanceParamRequest()
req = models.DescribeDBInstanceRebootTimeRequest()
req.InstanceIds = ["cdb-1y6g3zj8"]


# Call the API you want to access through the client object. You need to pass in the request object.
resp = client.DescribeDBInstanceRebootTime(req)

# Output the response packet as a json string.
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback