MySQL allows you to create multiple user accounts and grant appropriate privileges so that the users can connect and manage databases.

If the user account is no longer needed, it is a good idea to either remove the user privileges or to completely delete the user account.

This tutorial explains how to delete MySQL/MariaDB user accounts.

DROP USER Statement

In MySQL, you can remove one or more users and assigned privileges with the DROP USER statement. The general syntax of this statement is as follows:

DROP USER [IF EXISTS] USER_ACCOUNT [, USER_ACCOUNT] ...

For example to remove the brian@localhost user account login to the MYSQL shell and run:

DROP USER 'brian@localhost';

On success the command will return:

Query OK, 0 rows affected (0.00 sec)

To remove multiple user accounts in a single command, run the DROP USER statement followed by the users you want to remove separated by space:

DROP USER 'brian@localhost' 'any@localhost';

If you try to drop a user account that does not exist and the IF EXISTS clause is not used the command will return an error.

If the user you are trying to remove is currently logged in, the user session will not be closed and the user will be able to run queries until the session ends. Once the session is closed the user is removed and it will no longer be able to log in to the MySQL server.

The databases and objects created by the user are not automatically removed.

#mysql

How to Delete MySQL Users Accounts
1.20 GEEK