I\'m using the MySQL command line utility and can navigate through a database. Now I need to see a list of user accounts. How can I do this?
I\'m using MySQL version
A user account comprises the username and the host level access.
Therefore, this is the query that gives all user accounts
SELECT CONCAT(QUOTE(user),'@',QUOTE(host)) UserAccount FROM mysql.user;
The mysql.db table is possibly more important in determining user rights. I think an entry in it is created if you mention a table in the GRANT command. In my case the mysql.users table showed no permissions for a user when it obviously was able to connect and select, etc.
mysql> select * from mysql.db;
mysql> select * from db;
+---------------+-----------------+--------+-------------+-------------+-------------+--------
| Host | Db | User | Select_priv | Insert_priv | Update_priv | Del...
I use this to sort the users, so the permitted hosts are more easy to spot:
mysql> SELECT User,Host FROM mysql.user ORDER BY User,Host;