How to Show Users in MariaDB on Ubuntu 22.04


In the last guide, we checked out the method for deleting users from MariaDB on Ubuntu 22.04. Today’s post will explain the procedure of showing users in MariaDB.

Showing users in MariaDB on Ubuntu refers to displaying a list of all user accounts that have been created in MariaDB. MariaDB utilizes user accounts and privileges to control access to the database. Each account has a username, authentication credentials, and privileges that define the actions the user can perform.

How to Show/Display Users in MariaDB on Ubuntu 22.04?

Showing users in MariaDB on Ubuntu can help ensure compliance with regulatory frameworks that require strict control over database access and user permissions. By displaying the list of users and their permissions, you can make sure that your database meets the necessary requirements.

This section will specifically demonstrate the method of showing users in MariaDB on Ubuntu 22.04.

Step 1: Open Ubuntu Terminal

For launching the Ubuntu 22.04’s terminal, hit “CTRL+ALT+T”:

Step 2: Access MariaDB Shell

Next, execute the following command to access the MariaDB shell:

sudo mysql -u root -p

Step 3: List Users

After that, type the command below in the MariaDB shell for listing all of the users:

SELECT User FROM mysql.user;

Step 4: Login via Another User (optional)

Once all users have been listed, you may log in to the MariaDB shell again through one of the listed users:

sudo mysql -u sharqa -p

Step 5: Showing Specific User’s Details

Utilize the command below, to display a specific user’s further details:

SELECT User, Host, authentication_string FROM mysql.user WHERE User = 'sharqa';


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

Conclusion

To show users in MariaDB on Ubuntu 22.04, launch the terminal. Then, connect to the MariaDB shell by using the “sudo mysql -u root -p” command. After that, utilize the “SELECT User FROM mysql.user;” command for listing all users. Now, you can log in to the MariaDB shell using one of the listed users but this step is totally optional.

Next, for showing more details of a specific user, execute the “SELECT User, Host, authentication_string FROM mysql.user WHERE User = ‘sharqa’;” command. That’s how you can show users in MariaDB on Ubuntu 22.04.

Print Friendly, PDF & Email
Categories