devxlogo

Understand Permissions Granted to a User in MySQL

Understand Permissions Granted to a User in MySQL

In MySQL, you can know the permissions granted to an user using the following statement.

We will now use this code to find the permissions available for user user_admin. This example is for illustration only.

mysqlSHOW GRANTS FOR user_admin

Sample output:

+--------------------------------------------------------+| Grants for user_admin@%                                |+--------------------------------------------------------+| GRANT ALL PRIVILEGES ON `db1`.* TO 'user_admin'@'%'    || GRANT ALL PRIVILEGES ON `db2`.* TO 'user_admin'@'%'    || GRANT ALL PRIVILEGES ON `db3`.* TO 'user_admin'@'%'    |+--------------------------------------------------------+

The output above indicates that the user user_admin has all privileges on the databases db1, db2, db3.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist