How to List Users in MariaDB on Ubuntu 22.04

In our previous post, we demonstrated the procedure of showing users and their details in MariaDB on Ubuntu 22.04. Today’s post will be about the method of listing users in MariaDB.

When we say, listing users in MariaDB on Ubuntu, it means getting a list of all the users who have been created in the MariaDB database server on an Ubuntu operating system. MariaDB users are basically individual accounts that are used to log in and control access to the database server.

How to List Users in MariaDB on Ubuntu 22.04?

To list users, we need to access the MariaDB server on Ubuntu and retrieve the information about the users. This can be helpful for tasks like keeping track of who has access to the database or managing user permissions.

This section will specifically elaborate on the procedure for listing all and particular users in MariaDB on Ubuntu 22.04.

Step 1: Open Ubuntu Terminal

Press “CTRL+ALT+T” or utilize the “Application Menu” for launching Ubuntu’s terminal:

Step 2: Access MariaDB Shell

Run the provided command in the Ubuntu’s terminal for accessing the MariaDB shell:

sudo mysql -u root -p

Step 3: Listing all Users

After that, list all users with the help of the following command:

SELECT User FROM mysql.user;

Step 4: List a Specific User

Type the mentioned command in the MariaDB shell for listing a specific user:

SELECT User FROM mysql.user WHERE User='sharqa';

Step 5: Exit MariaDB Shell

Exit the MariaDB shell by running this command:


That was all about listing users in MariaDB on Ubuntu 22.04.


To list users in MariaDB on Ubuntu 22.04, open the terminal. Next, access the MariaDB shell using the “sudo mysql -u root -p”. Now, to list all of the users you can use the “SELECT User FROM mysql.user;” command. If you want to list a specific user then type the “SELECT User FROM mysql.user WHERE User=’username’;” command in the MariaDB shell. Once you are done with all operations, get out of the MariaDB shell by utilizing the “exit” command. That’s how you can list users in MariaDB on Ubuntu 22.04.

Print Friendly, PDF & Email