Mysql Drop User Statement

MySQL: DROP USER statement

This tutorial explains how to use the MySQL DROP USER statement with syntax and examples.

Description

The DROP USER statement is used to remove a user from the MySQL database.

Syntax

The syntax for the DROP USER statement in MySQL is:

DROP USER user_name;

Parameters or Arguments

user_name

The name of the user to remove from the MySQL database.

Example

Let's look at how to drop a user in MySQL using the DROP USER statement.

For example:

DROP USER 'ao'@'localhost';

In this example, the DROP USER statement would drop the user called ao in the MySQL database.

Drop more than one user

How can you drop more than one user at a time in MySQL? You can use the DROP USER statement to drop multiple users by comma separating the users that you wish to drop.

For example:

DROP USER 'ao'@'localhost', 'andersonk'@'localhost';

This DROP USER example would drop two users in MySQL - ao and andersonk.