DROP USER
Description
This statement is used to drop one or more database users.
tip
-
You must have the
CREATE USERprivilege at the global level to use theDROP USERstatement. -
You cannot delete users from the
mysql.usertable using theDELETEstatement. You must use theDROPstatement. -
After a user is dropped, all of their privileges are also removed.
Syntax
DROP USER [IF EXISTS] user_name [, user_name...];
Parameters
| Parameter | Description |
|---|---|
| IF EXISTS | Optional. When specified, attempting to drop a non-existent user generates a warning instead of an error. If not specified, attempting to drop a non-existent user generates an error. |
| user_name | The username. When dropping multiple users, separate the usernames with commas. |
Examples
Drop the user named sqluser01.
DROP USER sqluser01;
Query OK, 0 rows affected (0.001 sec)