Removing users

In the Revoking permissions section given previously in this chapter, there is an example for removing all the privileges of a user, but this doesn't actually remove the user. To remove a user completely, we use the DROP USER statement. It has the following pattern:

DROP USER <user>;

The following is an example of this:

DROP USER 'tom'@'%';

When a user is dropped, all permissions are automatically removed as well.

Note

Complete documentation of the DROP USER statement is available at the following location:

https://mariadb.com/kb/en/drop-user/

Get Getting Started with MariaDB - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.