All Products
Search
Document Center

PolarDB:CreateAccount

Last Updated:Dec 13, 2024
This topic is generated by a machine translation engine without any human intervention. ALIBABA CLOUD DOES NOT GUARANTEE THE ACCURACY OF MACHINE TRANSLATED CONTENT. To request a human-translated version of this topic or provide feedback on this translation, please include it in the feedback form.

Creates a database account for a PolarDB cluster.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
polardb:CreateAccountcreate
*dbcluster
acs:polardb:{#regionId}:{#accountId}:dbcluster/{#dbclusterId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBClusterIdstringYes

The ID of cluster.

pc-**************
AccountNamestringYes

The name of the account. The name must meet the following requirements:

  • It must start with a lowercase letter and end with a letter or a digit.
  • It can contain lowercase letters, digits, and underscores (_).
  • It must be 2 to 16 characters in length.
  • It cannot be root, admin, or another username that is reserved by the system.
testacc
AccountPasswordstringYes

The password of the account. The password must meet the following requirements:

  • The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.
  • The password must be 8 to 32 characters in length.
  • Special characters include ! @ # $ % ^ & * ( ) _ + - =
Test1111
AccountTypestringNo

The type of the account. Valid values:

  • Normal: standard account
  • Super: privileged account.
Note
  • If you leave this parameter empty, the default value Super is used.

  • You can create multiple privileged accounts for a PolarDB for PostgreSQL (Compatible with Oracle) cluster or a PolarDB for PostgreSQL cluster. A privileged account has more permissions than a standard account. For more information, see Create a database account.

  • You can create only one privileged account for a PolarDB for MySQL cluster. A privileged account has more permissions than a standard account. For more information, see Create a database account.

Normal
AccountDescriptionstringNo

The description of the account. The description must meet the following requirements:

  • It cannot start with http:// or https://.
  • It must be 2 to 256 characters in length.
testdes
DBNamestringNo

The name of the database that can be accessed by the account. To enter multiple database names, separate the names with commas (,).

Note This parameter is valid only for standard accounts of PolarDB for MySQL clusters.
testdb
AccountPrivilegestringNo

The permissions that are granted to the account. Valid values:

  • ReadWrite: read and write permissions.
  • ReadOnly: read-only permissions.
  • DMLOnly: the permissions to execute only DML statements.
  • DDLOnly: the permissions to execute only DDL statements.
  • ReadIndex: the read-only and index permissions.
Note
  • AccountPrivilege is valid only after you specify DBName.

  • If multiple database names are specified by the DBName parameter, you must grant permissions on the databases. Separate multiple permissions with commas (,), and make sure that the length of the value of AccountPrivilege does not exceed 900. For example, if you want to grant the account the read and write permissions on DB1 and the read-only permissions on DB2, set DBName to DB1,DB2 and set AccountPrivilege to ReadWrite,ReadOnly.

  • This parameter is valid only for standard accounts of PolarDB for MySQL clusters.

ReadWrite
ClientTokenstringNo

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 it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. The token is case-sensitive.

6000170000591aed949d0f54a343f1a4233c1e7d1c5c******

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

CED079B7-A408-41A1-BFF1-EC608E******

Examples

Sample success responses

JSONformat

{
  "RequestId": "CED079B7-A408-41A1-BFF1-EC608E******"
}

Error codes

HTTP status codeError codeError messageDescription
400LockTimeoutThe request processing has failed due to lock timeout.Failed to process the request due to a lock timeout.
400EngineMigration.ActionDisabledSpecified action is disabled while custins is in engine migration.The specified operation is disabled when custins is being migrated across engines.
400InvalidAccountPassword.MalformedThe specified parameter AccountPassword is not valid.The specified AccountPassword parameter is invalid.
400InvalidAccountType.MalformedThe specified parameter AccountType is not valid.The specified AccountType parameter is invalid.
400InvalidAccountDescription.MalformedThe specified parameter AccountDescription is not valid.The specified AccountDescription parameter is invalid.
400InvalidAccountPrivilege.MalformedThe specified parameter AccountPrivilege is not valid.The specified AccountPrivilege parameter is invalid.
400InvalidAccountName.MalformedThe specified parameter AccountName is not valid.The specified AccountName parameter is invalid.
404InvalidDBClusterId.NotFoundThe DBClusterId provided does not exist in our records.The specified DBClusterId parameter does not exist in the current record.
404InvalidDBClusterId.MalformedThe specified parameter DBClusterId is not valid.The specified DBClusterId parameter is invalid.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-01-24The Error code has changedView Change Details
2023-09-12The Error code has changedView Change Details
2023-07-20API Description Update. The Error code has changed. The request parameters of the API has changedView Change Details