Updated on 2026-05-16 GMT+08:00

Users and Permissions

Table 1 Syntax differences between an M-compatible database and GaussDB

No.

Syntax

Overview

Difference

1

CREATE ROLE

Creates a role.

In M-compatible mode:

Options involving the following keywords cannot be specified: ENCRYPTED, UNENCRYPTED, RESOURCE POOL, PERM SPACE, TEMP SPACE, and SPILL SPACE.

2

CREATE USER

Creates a user.

3

CREATE GROUP

Creates a user group. CREATE GROUP is the alias of CREATE ROLE and is not recommended.

4

ALTER ROLE

Modifies role attributes.

5

ALTER USER

Modifies user attributes.

6

ALTER GROUP

Modifies the attributes of a user group.

-

7

DROP ROLE

Drops a role.

-

8

DROP USER

Drops a user.

-

9

DROP GROUP

Drops a user group.

-

10

DROP OWNED

Drops the database objects owned by a database role.

-

11

REASSIGN OWNED

Changes the owner of a database object.

This syntax is not supported in an M-compatible database.

12

GRANT

Grants permissions to roles and users.

In an M-compatible database, permissions on objects such as functions, stored procedures, tablespaces, and database links cannot be granted or revoked.

13

REVOKE

Revokes permissions from one or more roles.

14

ALTER DEFAULT PRIVILEGES

Sets the permissions that will be granted to objects created in the future. (It does not affect permissions granted to existing objects.)

This syntax is not supported in an M-compatible database.

  • In MySQL, 'dbname.*' indicates a schema-level authorization object. In an M-compatible database, '{DATABASE | SCHEMA} dbname' indicates a schema-level authorization object.
  • In MySQL, a username consists of two parts: username@hostname; in an M-compatible database, a username consists of only the username itself.
  • MySQL allows you to modify user verification, secure connection, and resource parameter attributes (including auth_option, tls_option, and resource option) using the GRANT syntax. In M-compatible databases, these cannot be modified using the GRANT syntax; instead, you need to use CREATE USER and ALTER USER to set user attributes.
  • MySQL supports permission granting with a user proxy. GRANT PROXY ON is used to manage permissions of users in a unified manner. MySQL 5.7 does not provide the role mechanism, but MySQL 8.0 and M-compatible databases provide the role mechanism. If a role can manage and control the permissions of users in a unified manner, it can replace GRANT PROXY ON.
  • M-compatible databases have a concept called public. All users have public permissions and they can query some system catalogs and system views. Users can grant or revoke public permissions. In MySQL, newly created users have only the global usage permission, which is almost low to none. They have only the permission to connect to the database and query the information_schema database.
  • In M-compatible databases, the owner of an object has all permissions on the object by default. For security purposes, the owner can discard some permissions. However, ALTER, DROP, COMMENT, INDEX, VACUUM, and re-grantable permissions on the object are implicitly inherent permissions of the owner. In MySQL, there is no notion of "owner". Even if a user creates a table, they cannot perform operations such as IUD on the table without being granted the corresponding permissions.
  • In MySQL, All users have the USAGE permission, which indicates no permission. When REVOKE or GRANT USAGE is executed, no modification is performed. In M-compatible databases, the USAGE permission has the following meanings:
    • For schemas, USAGE allows access to objects contained in the schema. Without this permission, it is still possible to see the object names.
    • For sequences, USAGE allows use of the nextval function.
  • In M-compatible databases, administrator roles can be set for users, including the system administrator (SYSADMIN), security administrator (CREATEROLE), audit administrator (AUDITADMIN), monitor administrator (MONADMIN), O&M administrator (OPRADMIN), and security policy administrator (POLADMIN). By default, SYSADMIN have the highest permission in the system. After separation of duties is enabled, a system administrator does not have the CREATEROLE or AUDITADMIN attribute. That is, the system administrator can neither create roles or users, nor view or maintain database audit logs. In MySQL, administrator roles cannot be set for users, and there is no design for separation of duties.
  • In M-compatible databases, the ANY permission can be granted to a user, indicating that the user can have the corresponding permission in non-system schemas, including CREATE ANY TABLE, SELECT ANY TABLE, and CREATE ANY INDEX. In MySQL, the ANY permission cannot be granted to users.
  • MySQL provides SHOW GRANTS to query user permissions. In M-compatible databases, you can run gsql client meta-commands such as '\l+', '\dn+', or '\dp' to query permission information, or query related columns in system catalogs such as pg_namespace, pg_class, and pg_attribute for permission information.
  • When a database, table, or column is deleted, the related permission granting information is still retained in system catalogs in MySQL. If an object with the same name is created again, the user still has the original permissions. However, M-compatible databases will not retain such permission granting information. If an object with the same name is created again, permissions need to be granted again.
  • When granting database-level permissions, MySQL supports fuzzy match of database names using underscores (_) and percent signs (%). However, M-compatible databases do not support fuzzy match of object names using special characters such as underscores (_) or percent signs (%), which are identified as common characters.
  • In MySQL, if a non-existing user is specified in the GRANT statement, a user account is created by default (this feature has been removed from MySQL 8.0). In M-compatible databases, permissions cannot be granted to users who have not been created.