FreeKB - mySQL / MariaDB display a users privileges using SELECT mysql.users
mySQL / MariaDB - display a users privileges using SELECT mysql.users

This assume you are able to log into your MariaDB or mySQL server or you have configured passwordless authentication and will be using the -e command line option. The SELECT statement can be used to view a users privileges. The following privileges can be displayed.

  • Alter_priv
  • Create_priv
  • Delete_priv
  • Insert_priv
  • Select_priv
  • Shutdown_priv
  • Update_priv

In this example, root can SELECT, INSERT and UPDATE, but John cannot.

MariaDB [(none)]> select user,host,Select_priv,Insert_priv,Update_priv from mysql.user;
+------------------------------------------------------------+
| user | host      | Select_priv | Insert_priv | Update_priv |
+------------------------------------------------------------+
| root | 127.0.0.1 | Y           | Y           | Y           |
| root | ::1       | Y           | Y           | Y           |
| root | localhost | Y           | Y           | Y           |
| John | localhost | N           | N           | N           |
| John | %         | N           | N           | N           |
+------------------------------------------------------------+
5 rows in set (0.00 sec)

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 61953 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |