Updated on 2024-10-14 GMT+08:00

Creating a Database Account

Scenarios

You can use a stored procedure to create a login account. This account has all permissions of the rdsuser user on RDS for SQL Server databases.

  • The stored procedure can be executed only by the rdsuser user or the created account.
  • The password must consist of 8 to 32 characters and contain at least three types of the following characters: uppercase letters, lowercase letters, digits, and special characters (~!@#$%^*-_+?,).

Prerequisites

An RDS for SQL Server instance has been connected. For details about how to connect to a DB instance, see Connecting to a DB Instance Through a Public Network.

Procedure

Run the following command to create an account. After the command is executed successfully, you can use the created account to log in.

EXEC master.dbo.rds_create_major_login @login='loginName', @password='password' ;

  • loginName: login name of the created account.
  • password: password of the created account.

Example

Run the following command to create an account whose name is rdsuser1 and password is ******:

EXEC master.dbo.rds_create_major_login @login='rdsuser1', @password='******';

After the account is created successfully, information similar to the following is displayed:

HW_RDS_Process_Successful