Skip to main content

DROP USER

Description

This statement is used to drop one or more database users.

tip
  • You must have the CREATE USER privilege at the global level to use the DROP USER statement.

  • You cannot delete users from the mysql.user table using the DELETE statement. You must use the DROP statement.

  • After a user is dropped, all of their privileges are also removed.

Syntax

DROP USER [IF EXISTS] user_name [, user_name...];

Parameters

ParameterDescription
IF EXISTSOptional. 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_nameThe 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)