How to show user privileges in MySQL

In this article, we will find how to show user privileges in MySQL.

We can check the privileges granted to user in MySQL by using command show grants command.

How to show user privileges in MySQL

1. Connect to MySQL using below command.

sudo mysql -u root -p

2. Find the list of users(logins) present in MySQL server.

select user from mysql.user;

How to show user privileges in MySQL

Syntax to show user privileges in MySQL:

show grants for user_name;

3. Show privileges granted for user ‘david’ in MySQL.

show grants for david;

4. To find the list of granted privileges for current user in MySQL Server.

show grants;

5. To find the list of granted privileges for a user with hostname in MySQL Server.

show grants for 'root'@'localhost';