百度智能云

All Product Document

          Data Warehouse

          SHOW-GRANTS

          SHOW GRANTS

          Description

          This statement is used to view the grants for users.

          SHOW [ALL] GRANTS [FOR user_identity];
          • ALL

            By using the key wordALL, user can view the grants for all users.

          1. user_identity

            View the grants for specified user. And the user_identity must be created by CREATE USER command.

            If user_identity is not specified, then view the grants for current user.

          Description of return results:

          mysql> show grants;
          +--------------+----------+----------------------+---------------+------------+---------------+
          | UserIdentity | Password | GlobalPrivs          | DatabasePrivs | TablePrivs | ResourcePrivs |
          +--------------+----------+----------------------+---------------+------------+---------------+
          | 'admin'@'%'  | Yes      | Admin_priv  (false)  | NULL          | NULL       | NULL          |
          +--------------+----------+----------------------+---------------+------------+---------------+
          1 row in set (0.00 sec)
          • UserIdentity

            User identity.

          • Password

            Yes indicates that a password is set. No indicates no password.

          • GlobalPrivs

            List of grants at the global level. ( false after list can be ignored).

          • DatabasePrivs

            List of grants at the database level. (false after list can be ignored).

          • TablePrivs

            List of grants at the table level. ( false after list can be ignored).

          Example

          1. View the grants for all users

            SHOW ALL GRANTS;
          2. View the grants for specified users

            SHOW GRANTS FOR jack@'%';
          3. View the grants for current user

            SHOW GRANTS;

          Keywords

          SHOW, GRANTS
          Previous
          SHOW-ROLES
          Next
          SHOW-EXPORT