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 |
+-------+




Related Posts

How To Specify Unique Constraint For Multiple Columns In MySQL

How to make multiple columns unique (together) in an existing...

How To Select One Row Per ID With Max Value On A Column

Suppose we have the following REIMBURSEMENT table, find the max...

How To Get The Size Of A Table In MySQL

How to get the size of a table in MySQL...

How To Get The Size Of A Database In MySQL

How to get the size of a database in MySQL...

How To Concatenate Multiple Rows Into One Field In MySQL

How to concatenate multiple rows into one field in MySQL...

How To Change The Data Type Of A Column In MySQL

Given a table EMPLOYEE, change the data type of the...