MySQL: DROP USER statement

  • Post author:
  • Post category:MySQL
  • Post comments:1 Comment
MySQL drop user statement

In this guide, we will explain 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 database.

Syntax

The syntax for the DROP USER statement in MySQL is:

DROP USER user_name;

Parameters or Arguments

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

Example

Let’s look at how to drop a user using the DROP USER statement.

For example:

DROP USER 'smithj'@'localhost';

In this example, the DROP USER statement would drop the user called smithj in the 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 'smithj'@'localhost', 'andersonk'@'localhost';

This DROP USER example would drop two users in MySQL – smithj and andersonk.

Next Topic : Click Here

This Post Has One Comment

Leave a Reply