How to get a list of MySQL user accounts?

Hi,

I have MySQL database and I created many users for different databases. I want to see the names of all the users.

How to get a list of MySQL user accounts?

Thanks

View Answers

November 5, 2017 at 6:56 PM

Hi,

In MySQL users information is stored in user table of mysql datababse (mysql.user).

To view the list of all the users you have to run the query to list all data from mysql.user table.

Here is query to see all the user accounts in MySQL:

SELECT User FROM mysql.user;

If you run the command it will print following output with list of users:

mysql> SELECT User FROM mysql.user;
+------------+
| User       |
+------------+
| webservice |
| root       |
| root       |
| root       |
| webservice |
+------------+
5 rows in set (0.10 sec)

mysql>

Thanks









Related Tutorials/Questions & Answers:
Advertisements