Monday, 18 April 2016

view a list of MySQL users and their privileges

You are running a multi-user MySQL database, some useful commands that show a list of all existing MySQL users
and their privileges. To find out all MySQL users and the permissions granted to each user, log in to your MySQL server,
and run the below MySQL commands.

mysql>select user,host from mysql.user;

+-----------+-------------+
| user      | host        |
+-----------+-------------+
| dbb        | %           |
| root      | 127.0.0.1   |
| dbb        | 192.168.1.% |
| root      | 192.168.1.% |
| dbb        | localhost   |
| mysql.sys | localhost   |
| root      | localhost   |
+-----------+-------------+
7 rows in set (0.00 sec)



mysql>  show grants for 'root'@'192.168.1.%';
+-----------------------------------------------------+
| Grants for root@192.168.1.%                         |
+-----------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.%' |
+-----------------------------------------------------+
1 row in set (0.00 sec)

1 comment: