Purpose
You can use this statement to drop one or more database users.
Notice
- To execute this statement, you must have the global
CREATE USERprivilege. - To drop a user in the
mysql.usertable, you must execute theDROPstatement instead of theDELETEstatement. - After you drop a user, all its privileges are dropped along with it.
Syntax
DROP USER [IF EXISTS] user_name [, user_name...];
Parameters
| Parameter | Description |
|---|---|
| IF EXISTS | Optional. When you attempt to drop a user that does not exist, a warning is generated if this clause is used, and an error is returned if this clause is not used. |
| user_name | The username. Multiple usernames must be separated with commas (,). |
Examples
Drop a user named sqluser01.
obclient> DROP USER sqluser01;
Query OK, 0 rows affected