Wednesday, 18 March 2015

How to get a list of MySQL user accounts?

How to get a list of MySQL user accounts?

In MySQL, you can get list of user account with user details. Just execute following Query of PHPMySQL/SQL Yog/Other MySQL Tools.

List of MySQL users.
SELECT User FROM mysql.user


List of MySQL unique users.
select distinct User from mysql.user;

List of MySQL users with password and host.
SELECT Host,User, Password FROM mysql.user


List of MySQL unique Users with password and host.
SELECT Host,User, Password FROM mysql.user  group by User



List of MySQL users with all permissions.
SELECT * FROM mysql.user WHERE 1