MySQL - DROP USER
The MySQL DROP USER statement is used to remove a user from the MySQL database.
Syntax
The syntax of using DROP USER statement in MySQL is given below:
DROP USER [IF EXISTS] user_name;
Parameters
IF EXISTS |
Optional. Specify it to conditionally remove a user only if it exists. If a user is removed which does not exist, it will raise an error. |
user_name |
Required. Specify the name of the user to remove from the MySQL database. |
Example: Drop a user
In the example below, the DROP USER statement is used to drop a user called john in the MySQL database.
DROP USER 'john'@'localhost';
Example: Drop more than one user
In the example below, two user is dropped in the MySQL database. The two users are - john and marry.
DROP USER 'john'@'localhost', 'marry'@'localhost';