How To Get A List Of User Accounts In MySQL
Short Answer
1
SELECT DISTINCT User FROM mysql.user;
MySQL stores the user information in its own database. The name of the database is mysql. Inside that database, the user information is in a table named user. This query gets unique user accounts. Sample output of this query would look like:
1
2
3
4
5
6
7
+-------+
| User |
+-------+
| root |
+-------+
| user2 |
+-------+