In this MySQL tutorial post we will see how to show all the users in MySQL.
Some time it is necessarily to get the information of all the users currently in MySQL database to avoid getting created new on with same name.
Type select user from mysql.user;
query in MySQL command line to list all the users in MySQL.
mysql> select user from mysql.user;
+------------------+
| user |
+------------------+
| mysql.infoschema |
| mysql.session |
| mysql.sys |
| root |
+------------------+
4 rows in set (0.03 sec)
We have 1 root users and other 3 users are created by MySQL itself.