MySQL MariaDB

MariaDB List Users

“You are allowed to create multiple users while working with the MariaDB server. After that, you can simply log in with the credentials of any specific user for accessing or creating the databases associated with that particular user. At times, you wish to see a list of all the users present on a MariaDB server. This list resides inside a system table titled “mysql.user”. Therefore, in this guide, we will show you the method of listing the MariaDB users on the console.”

How to List the Users in MariaDB?

For listing the users in MariaDB, you just have to perform the following simple steps:

Step # 1: Log Into the MariaDB Console

First, you need to log into the MariaDB console by running the command shown below:

$ sudo mysql –u root –p

The MariaDB console is shown in the following image:

Step # 2: List All the Users of MariaDB

To list the users that you have created so far in MariaDB, you just need to run the command shown below:

> select user from mysql.user;

This command will display all the users that you have created in MariaDB. In our case, we only had one user, i.e., the root user, which is shown in the following image:

Step # 3: List Other Information Along With the Users of MariaDB (Optional)

This step is optional; however, if you wish to display other information along with the users in MariaDB, such as hostnames, etc., then you just need to run the command shown below:

> select user, host from mysql.user;

The user names, along with their respective hostnames, will appear on the console after the execution of this command, as shown in the following image. In the same manner, if you wish to display the passwords associated with each user of MariaDB, then you can also mention the “password” keyword in the above-mentioned command.

Conclusion

By following this article, you can easily list down all the users present in your MariaDB server. No matter how many users you have created within your database server, you will easily be able to list them all down by making use of the prescribed method.

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.