MySQL MariaDB

How to Delete MariaDB User?

“MariaDB is an open-source, relational database management system (RDBMS) created by the developers of MySQL. With the help of the MariaDB client, you can add new users and give them different degrees of privileges with ease.

To learn more about MariaDB, check this out:

https://mariadb.org/

Today, we will explore how we can delete a user in the MariaDB database. The lesser the users, the more secure our database stays. To remove unnecessary users from MariaDB, you only need a simple command and root privileges.”

Guide

Following are the steps involved in deleting a user from the MariaDB database:

Step 1: Log in to the MariaDB database instance using your root account

The very first step involves logging into the MariaDB database as the root user. Do that by executing the below-mentioned command:

mariadb -u root -p

OR

sudo mariadb

You can use either of the two commands mentioned above; all up to you.

Step 2: Delete user

Once you are logged in as root, you can easily delete a user. To do that, follow the command below:

DROP USER 'user123'@'localhost';

Replace user123 with the user you want to delete. After this, the user will be instantly removed. You can then exit the database by running the exit command.

Yes, it is that simple!

Conclusion

In today’s tutorial, we saw in detail how to delete a user from the MariaDB database. All you need is root privilege to delete a user. The process is very straightforward; we ran only 2 commands to show you how to delete a user. Keeping fewer users maintains the security of the database. Make sure you only have the right users on your database and remove the unnecessary ones, as shown in this guide.

We hope you liked our tutorial.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.