Data Management Service (DMS) lets you manage fine-grained permissions for MySQL database accounts at the database, table, column, and view levels. This topic describes how to manage MySQL database account permissions in DMS.
Prerequisites
The database is one of the following types: RDS for MySQL, PolarDB for MySQL, AnalyticDB for MySQL, a self-managed MySQL database, MariaDB, or RDS for MariaDB.
A system role of Administrator, Database Administrator (DBA), or Regular User (Instance Owner)
-
You must have the database account and database password for the target database.
Function introduction
You can manage common permission sets, such as read-only, read/write, DML only, and DDL only, in the consoles for RDS for MySQL and PolarDB for MySQL. For more complex scenarios, such as creating custom permission sets or granting table-level permissions, you can use the database account permission management feature in DMS. For example:
Grant Account A the global
SELECTandUPDATEpermissions.NoteGlobal permissions apply to the entire database instance. For more information, see MySQL global permissions.
Grant Account B the
SELECTpermission on a single table or theUPDATEpermission on a specific column.NoteObject permissions can apply to all database objects or to one or more specific database objects. For more information, see MySQL object permissions.
Create an account
Log in to DMS 5.0.
-
Log on to the destination database. For more information, see Log on to a database.
-
On the home page, click the database instance in the navigation pane on the left. In the instance list, right-click the destination instance name and click Database Account Management.
-
On the Database Account Management page, click Create Database Account in the upper-left corner.
In the dialog box that appears, configure the following parameters.
Click the Basic settings tab and configure the parameters.

Configuration item
Description
Database Account
The account used to log on to the database.
Host
The IP address from which the account is allowed to access the database.
NoteIf you leave this blank, the account can access the database from any IP address. The default value is
%.Password
Enter the logon password.
Confirm Password
Enter the logon password again.
NoteThe SQL statement for the preceding configuration is
CREATE USER 'username'@'host' IDENTIFIED BY 'password';.To configure Advanced Options, click the Advanced Options button and configure the parameters.
For example, the SQL statement for the configuration in the following figure is:
GRANT USAGE ON *.* TO 'username'@'host' WITH MAX_QUERIES_PER_HOUR 100 MAX_UPDATES_PER_HOUR 200 MAX_CONNECTIONS_PER_HOUR 300 MAX_USER_CONNECTIONS 400;
Click the Global permissions tab and select the required permissions.
NoteIf you use a standard account and cannot find the required permission, it may be because the permission is not supported by the instance type or your account does not have the required permissions. If your account permissions are insufficient, you can retry the operation using a privileged account.
Click the Object permissions tab and configure the parameters.
For example, the SQL statement for the configuration in the following figure is:
GRANT SELECT,INSERT ON `rds_db`.* TO 'username'@'host'; GRANT DELETE ON `rds_db`.`rds_table` TO 'username'@'host';
Click Confirm.
In the Preview SQL Statement window, click Confirm.
NoteDatabase instances in Security Collaboration mode are subject to security rules. If the execution fails, follow the on-screen instructions or contact a DBA or an administrator for confirmation. For more information about how to adjust the rules, see the FAQ section.
Edit or delete an account
You can edit an account to modify its username, password, and MySQL global and object permissions.
Log in to DMS 5.0.
-
On the home page, click the database instance in the navigation pane on the left. In the instance list, right-click the destination instance name and click Database Account Management.
Find the target account and click Edit or Delete.
MySQL global permissions
Permission | Authorized object | Permissions |
CREATE | Databases, tables, or indexes | Grants permission to create databases, tables, or indexes. |
DROP | Databases, tables, or views | Revoke permissions on a database, table, or view. |
GRANT OPTION | Databases, tables, or stored programs | Permission options. |
REFERENCES | Databases, tables, or columns | Grants permission to create foreign keys. |
LOCK TABLES | Databases | Grants permission to lock tables. |
EVENT | Databases | Grants permission to query, create, modify, and delete MySQL events. |
ALTER | Tables, views | Grants permission to alter tables or views. For example, add fields, add indexes, or modify fields. |
DELETE | Tables | You can delete a database permission. |
INDEX | Tables | Index permissions |
INSERT | Tables, columns | Grants permission to insert data. |
SELECT | Tables, columns | Grants permission to query data. |
UPDATE | Tables, columns | Grants permission to update data. |
CREATE VIEW | Views | Grants permission to create views. |
SHOW VIEW | Views | Grants permission to view views. |
TRIGGER | Triggers | Grants permission to create, drop, execute, and show triggers. |
ALTER ROUTINE | Stored procedures | Grants permission to alter stored procedures. |
CREATE ROUTINE | Stored procedures | Grants permission to create stored procedures. |
EXECUTE | Stored procedures | Grants permission to execute stored procedures. |
FILE | File access on the server host | File access permissions. |
CREATE TEMPORARY TABLES | Server management | Grants permission to create temporary tables. |
CREATE USER | Server management | Grants permission to create accounts. |
PROCESS | Server management | You can view process permissions. |
RELOAD | Server management | Grants permission to execute commands such as |
REPLICATION CLIENT | Server management | Grants replication permission. |
REPLICATION SLAVE | Server management | Grants replication permission. |
SHOW DATABASES | Server management | You can view database permissions. |
SHUTDOWN | Server management | Disable the server permission. |
SUPER | Server management | Grants permission to kill threads. Note RDS for MySQL and RDS for MariaDB do not support the SUPER permission. |
MySQL object permissions
Permission | Target Object | Permissions |
CREATE | Databases, tables, or indexes | Grants permission to create databases, tables, or indexes. |
DROP | Databases, tables, or views | You can revoke permissions on databases, tables, or views. |
GRANT OPTION | Databases, tables, or stored programs | Permission granting options |
REFERENCES | Databases, tables, or columns | Grants permission to create foreign keys. |
LOCK TABLES | Databases | Grants permission to lock tables. |
EVENT | Databases | Grants permission to query, create, modify, and delete MySQL events. |
ALTER | Tables, views | Grants permission to alter tables or views. For example, add fields, add indexes, or modify fields. |
DELETE | Tables | You can delete the database permission. |
INDEX | Tables | Index permissions |
INSERT | Tables, columns | Grants permission to insert data. |
SELECT | Tables, columns | View permissions. |
UPDATE | Tables, columns | Grants permission to update data. |
CREATE VIEW | Views | Grants permission to create views. |
SHOW VIEW | Views | View permissions. |
TRIGGER | Triggers | Grants permission to create, drop, execute, and show triggers. |
FAQ
Q: When I create a user, an error message indicates that the CREATE_USER command is blocked by security rules. How can I resolve this?
A: Follow the steps in the error message dialog box:
Find the name of the security rule set that is attached to the instance.
On the home page, find the target instance in the instance list on the left. Then, right-click the instance and click View Details.
Adjust the security rule.
-
Log on to DMS.
-
In the top menu bar, choose .
-
On the security rules tab, find the target rule set and click Edit in the Actions column.
-
In the left-side navigation pane, click SQL Correct.
In the Checkpoint field, select SQL Execution Rule.
Select the Allow all DCL statements to be directly executed in the SQL console security rule, and click Edit in the Actions column.
In the Rule DSL section of the Edit Rule dialog box, add the CREATE_USER SQL type.

-
Click Submit.
