MariaDB Tutorial MariaDB Advanced MariaDB Database Account Management MariaDB References

MariaDB - DROP USER



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

Syntax

The syntax of using DROP USER statement in MariaDB 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 MariaDB database.

Example: Drop a user

In the example below, the DROP USER statement is used to drop a user called john in the MariaDB database.

DROP USER 'john'@'localhost';

Example: Drop more than one user

In the example below, two user is dropped in the MariaDB database. The two users are - john and marry.

DROP USER 'john'@'localhost', 'marry'@'localhost';