How to Identify What MySQL Accounts Currently Exist

By Steve Suehring, Janet Valade

To see your MySQL account information, you can execute an SQL query, using the mysql client. To see what accounts currently exist for your database, you need an account that has the necessary privileges.

All the account names are stored in a database named mysql in a table named user. To see the account information, you can execute the following query on a database named mysql:


You should get a list of all the accounts. However, if you’re accessing MySQL through your company or a web hosting company, you probably don’t have the necessary privileges. In that case, you might get an error message like this:

No Database Selected

This message means that your account is not allowed to select the mysql database. Or you might get an error message saying that you don’t have the SELECT privilege. Even though this message is annoying, it’s a sign that the company has good security measures in place.

However, it also means that you can’t see what privileges your account has. You must ask your MySQL administrator or try to figure it out yourself by trying queries and seeing whether you’re allowed to execute them.