All Products
Search
Document Center

PolarDB:CreateAccount

Last Updated:Jul 02, 2026

Creates a PolarDB database account.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

DBClusterId

string

Yes

The cluster ID.

pc-**************

AccountName

string

Yes

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

  • Starts with a lowercase letter and ends with a letter or digit.

  • Contains only lowercase letters, digits, or underscores (_).

  • Is 2 to 16 characters in length.

  • Cannot use certain reserved usernames such as root or admin.

testacc

AccountPassword

string

Yes

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

  • Contains at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.

  • Is 8 to 32 characters in length.

  • Special characters include !@#$%^&*()_+-=.

Test1111

AccountType

string

No

The account type. Valid values:

  • Normal: standard account.

  • Super: privileged account.

  • DynamoDB: DynamoDB account.

Note
  • If this parameter is left empty, a Super account is created by default.

  • If the cluster is a PolarDB for PostgreSQL (Compatible with Oracle) or PolarDB for PostgreSQL cluster, you can create multiple privileged accounts for each cluster. Privileged accounts have more permissions than standard accounts. For more information, see Create a database account.

  • If the cluster is a PolarDB for MySQL cluster, you can create at most one privileged account for each cluster. Privileged accounts have more permissions than standard accounts. For more information, see Create a database account.

  • DynamoDB accounts are dedicated accounts created for the DynamoDB compatibility feature of PolarDB for PostgreSQL. For more information, see DynamoDB usage instructions.

Normal

AccountDescription

string

No

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

  • Cannot start with http:// or https://.

  • Is 2 to 256 characters in length.

testdes

DBName

string

No

The name of the database that the account is authorized to access. You can specify multiple database names separated by commas (,).

Note

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

testdb

AccountPrivilege

string

No

The permissions of the account. Valid values:

  • ReadWrite: read and write

  • ReadOnly: read-only

  • DMLOnly: DML only

  • DDLOnly: DDL only

  • ReadIndex: read-only and index

Note
  • The DBName parameter must be specified for AccountPrivilege to take effect.

  • If you specify multiple database names for the DBName parameter, you must grant the corresponding permissions to each database. Separate multiple permissions with commas (,) and make sure that the total length of the AccountPrivilege string does not exceed 900 characters. For example, to grant read and write permissions on database DB1 and read-only permissions on database DB2, set DBName to DB1,DB2 and set AccountPrivilege to ReadWrite,ReadOnly.

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

ReadWrite

ClientToken

string

No

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value. Make sure that the value is unique among different requests. The token is case-sensitive and cannot exceed 64 ASCII characters in length.

6000170000591aed949d0f54a343f1a4233c1e7d1c5c******

PrivForAllDB

string

No

Specifies whether to grant permissions on all existing databases and all new databases in the current cluster. Valid values:

  • 0 or empty: does not grant permissions.

  • 1: grants permissions.

Note
  • The AccountPrivilege parameter must be specified for this parameter to take effect.

  • If this parameter is set to 1, the permissions specified by AccountPrivilege are granted on all databases.

0

NodeType

string

No

The node type. Valid values:

  • Search: required when creating an account for a PolarDB Search node

Search

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

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

Examples

Success response

JSON format

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

Error codes

HTTP status code

Error code

Error message

Description

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

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.