Skip to main content

Manage roles

You can manage account roles using the default stored procedures provided by KakaoCloud MySQL.

Grant permission to role

Stored procedure for granting permissions to a user-created role.

Procedure name

mysql.mnms_grant_right_role

Procedure parameters

NameData typeDescription
p_roleVARCHAR(20)Name of role to grant permissions to
p_rightVARCHAR(8000)Permissions to grant to the role
p_target_dbVARCHAR(250)Target database for permission
p_target_schemaVARCHAR(250)Target object in the database

How to use

CALL mysql.mnms_grant_right_role('UserName_dev_role', 'ALTER, CREATE, DELETE, DROP, EXECUTE, INSERT, SELECT, UPDATE', 'DBName', 'Object');

Example

Grant permission to role

Image

caution

GRANT option is excluded from the Admin user account. Therefore, permissions can only be granted using system-provided procedures.

Revoke permission from role

Stored procedure for revoking permissions from a user-created role.

Procedure name

mysql.mnms_revoke_right_role

Procedure parameters

NameData typeDescription
p_roleVARCHAR(20)Name of role to revoke permissions from
p_rightVARCHAR(8000)Permissions to revoke from the role
p_target_dbVARCHAR(250)Target database for revoking permission
p_target_schemaVARCHAR(250)Target object in the database

How to use

CALL mysql.mnms_revoke_right_role('UserName_dev_role', 'ALTER, CREATE, DELETE, DROP, EXECUTE, INSERT, SELECT, UPDATE', 'DBName', 'Object');

Example

  1. Revoke role permission

Image

caution

GRANT option is excluded from the Admin user account. Therefore, granting and revoking permissions must be performed using system-provided procedures.

Map user to role

Stored procedure for mapping a user to a user-created role.

Procedure name

mysql.mnms_grant_role_user

Procedure parameters

NameData typeDescription
p_roleVARCHAR(20)Name of the role
p_userVARCHAR(32)Name of the user account to map to the role
p_hostVARCHAR(20)Host range allowed to access

How to use

CALL mysql.mnms_grant_role_user('UserName_dev_role', 'UserName_dev', '%');

Example

Map user to role

Image

caution

GRANT option is excluded from the Admin user account. Therefore, granting and revoking permissions must be performed using system-provided procedures.

Unmap user from role

Stored procedure for unmapping a user from a user-created role.

Procedure name

mysql.mnms_revoke_role_user

Procedure parameters

NameData typeDescription
p_roleVARCHAR(20)Name of the role
p_userVARCHAR(32)- Name of the user account to unmap
- Only lowercase letters and underscores (_) are allowed; length must be between 1 and 32 characters (same as console)
p_hostVARCHAR(20)Host range allowed to access

How to use

CALL mysql.mnms_revoke_role_user('UserName_role', 'UserName', '%');

Example

Unmap user from role

Image

caution

GRANT option is excluded from the Admin user account. Therefore, granting and revoking permissions must be performed using system-provided procedures.