MySQL SHOW USERS: List All Users in a MySQL Database Server
MySQL SHOW USERS: List All Users in a MySQL Database Server:
>mysql -u root -p
Enter password: ***********
mysql> use mysql;
Database changed
mysql> SELECT user FROM user;
To get more information on the user
table, you can preview its columns using the following command:
DESC user;
To show users and other information such as host, account locking, and password expiration status, you use the following query:
SELECT user, host, account_locked, password_expired FROM user;
To get the information on the current user, you use the user()
function as shown in the following statement:
mysql> SELECT current_user();
To list all users that are currently logged in the MySQL database server, you execute the following statement:
SELECT
user,
host,
db,
command
FROM
information_schema.processlist;
Leave a Comment