All Products
Search
Document Center

ApsaraDB RDS:Manage users

Last Updated:Apr 15, 2025

This topic describes how to use SQL statements to create and manage users on an ApsaraDB RDS for SQL Server instance.

Note

You can create users only in the databases that you created but not in system databases.

Prerequisites

Create a user

USE [TestDB]; -- Switch to the database TestDB
GO
CREATE USER [TestUser] FOR LOGIN [TestLogin]; -- Create a user named TestUser for the login TestLogin in TestDB

Modify the user information

USE [TestDB]; -- Switch to the database TestDB
GO
ALTER USER [TestUser] WITH LOGIN = [NewLogin]; -- Change the login of TestUser to NewLogin

Delete a user

USE [TestDB]; -- Switch to the database TestDB
GO
DROP USER [TestUser]; -- Delete TestUser