List All Users in MySQL Database

Login to the database as root user
mysql -u root -p
Once you have logged in as root user, run the following command to list the user, host and encrypted password
SELECT User, Host, Password FROM mysql.user;
output :

MariaDB [(none)]> SELECT User, Host, Password FROM mysql.user;
+----------+-----------+-------------------------------------------+
| User     | Host      | Password                                  |
+----------+-----------+-------------------------------------------+
| root     | localhost | *B96CFA2060FA027DC75E805C7B40F149C3DFD0A6 |
| admin    | localhost | *DB6A3951B02A12D0B88DE7EB208D018F37A4AE51 |
| sam      | %         | *BD988A20742A8AB22F4F4D51B54F07C16B081223 |
| james    | %         | *0EA7A188F17A92637340CEDCC8D412598530AF75 |
+----------+-----------+-------------------------------------------+
4 rows in set (0.00 sec)


List All Users in MySQL Database
Scroll to top