List of All Users – MySQL

When there is a MySQL Server, there could be many users setup to login and access the server. Incase, if you are wondering how to get the list of all those users, we have a solution.

To get the list of all users present on a MySQL server, login to MySQL Server and run the following query in mysql command line interface.

</>
Copy
SELECT user FROM mysql.user;
MySQL - Select user from mysql.users

The query returns only user names.

mysql.user table has properties of users like SELECT PRIVILEGE, INSERT PRIVILEGE, UPDATE PRIVILEGE, DELETE PRIVILEGE, CREATE PRIVILEGE, etc.

So, if you display all the contents of the table using the SQL Query SELECT * FROM mysql.user;, all the privilege details corresponding to the users are displayed.