Last Updated: 28 June, 2023
In MySQL, we can retrieve a list of users by querying the mysql.user table. This table stores information about the users registered in your MySQL server.
Here's an example of how you can show the users:
SELECT User, Host FROM mysql.user;
This query will return the usernames (User) and their corresponding hostnames (Host) registered in the mysql.user table. The Host column indicates the source from which the user is allowed to connect (e.g., localhost, a specific IP address, or a wildcard % for any host).
Note that we need appropriate privileges to execute this query. Typically, only users with the SELECT privilege on the mysql.user table or with higher administrative privileges can retrieve this information.
That's all, guys. I hope this MySQL article is helpful for you.
Happy Learning... 😀
feedback@javabytechie.com