Drop a user

2025-01-02 01:58:40  Updated

This topic describes how to drop a user that you no longer need by using the DROP USER statement.

Prerequisites

To execute the DROP USER statement, you must have the global CREATE USER privilege. For more information about how to view your privileges, see View user privileges. If you do not have the required privilege, contact the administrator to obtain the privilege. For more information about how to grant privileges to a user, see Grant direct privileges.

Limitations

You cannot use the DELETE statement to delete user privileges from the mysql.user table.

Procedure

  1. Log in to a MySQL tenant of a cluster.

  2. Execute the following statement to drop one or more users:

    DROP USER user_name [, user_name...];
    

    user_name specifies the username for the user to be dropped. To drop multiple users, separate their usernames with commas (,).

    After you drop a user, the database objects created by the user are not dropped. However, all privileges of the user are dropped.

    For example, drop the sqluser02 user.

    obclient> DROP USER sqluser02;
    Query OK, 0 rows affected
    

References

For more information about the DROP USER statement, see DROP USER.

Contact Us