Home » Programming » Databases » Mysql Show List Users

How to List/Show Users in MySQL/MariaDB

This short article will show you how to list all of the users on your MySQL server.

MySQL Users and Permissions

MySQL databases usually have access granted to only certain users, each with their own permissions limiting what they can and can’t do on that specific database.

As there are often multiple databases on a server, there will be several user accounts – some for different databases, some from different hosts – so it’s useful to be able to list them all out quickly.

Command to List Users

Once you’re connected to your MySQL database server, issue the following command to list the users on the system:

SELECT * FROM mysql.user;

The information for the users on a MySQL server is all stored in the MySQL database in the users table.

Quite a bit of information will be returned – you can return only the information you need by altering the SELECT statement to include only the required columns:

SELECT user, host FROM mysql.user;

While there is a password column, it should be empty, or the contents should be hashed to be of no use. MySQL does not store passwords in plain text, so the contents of that column are of no use.

Get User Privileges

Users can have different privileges on one or more databases. To find out how to view them, check out our article on showing privileges in MySQL here.

Check out the official documentation here for more detail on how MySQL stores information on users and permissions.

SHARE:
Photo of author
Author
I'm Brad, and I'm nearing 20 years of experience with Linux. I've worked in just about every IT role there is before taking the leap into software development. Currently, I'm building desktop and web-based solutions with NodeJS and PHP hosted on Linux infrastructure. Visit my blog or find me on Twitter to see what I'm up to.

Leave a Comment