All Products
Search
Document Center

PolarDB:CreateAccount

Last Updated:Jun 17, 2024

Creates a database account for a PolarDB cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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:CreateAccountWrite
  • 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:

  • It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.
  • It 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 Oracle or PolarDB for PostgreSQL cluster. A privileged account is granted more permissions than a standard account. For more information about how to create a database account, see Create a database account.

  • You can create only one privileged account for a PolarDB for MySQL cluster. A privileged account is granted more permissions than a standard account. For more information about how to create a database account, 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 and index permissions
Note
  • The AccountPrivilege parameter is valid only after you specify the DBName parameter.

  • If multiple database names are specified by the DBName parameter, you must grant permissions on the databases. Separate multiple permissions with commas (,). 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.
404InvalidDBClusterId.NotFoundThe DBClusterId provided does not exist in our records.The specified DBClusterId parameter does not exist in the current record.

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

Change history

Change timeSummary of changesOperation
2024-01-24The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 404
2023-09-12The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Error Codes 404 change
2023-07-20API Description Update. The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
API DescriptionAPI Description Update.
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 404
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: PrivForAllDB