- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Display all grants for user in MySQL
Use INFORMATION_SCHEMA.SCHEMA_PRIVILEGES to display all grants for a user −
select *from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES;
Let us implement the above syntax to show all grants for a user −
mysql> select *from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES;
This will produce the following output −
+-----------------------------+---------------+--------------------+-------------------------+--------------+ | GRANTEE | TABLE_CATALOG | TABLE_SCHEMA | PRIVILEGE_TYPE | IS_GRANTABLE | +-----------------------------+---------------+--------------------+-------------------------+--------------+ | 'mysql.sys'@'localhost' | def | sys | TRIGGER | NO | | 'Adam Smith'@'localhost' | def | test | SELECT | NO | | 'Adam Smith'@'localhost' | def | test | INSERT | NO | | 'Adam Smith'@'localhost' | def | test | UPDATE | NO | | 'Adam Smith'@'localhost' | def | test | DELETE | NO | | 'Adam Smith'@'localhost' | def | test | CREATE | NO | | 'Adam Smith'@'localhost' | def | test | DROP | NO | | 'Adam Smith'@'localhost' | def | test | REFERENCES | NO | | 'Adam Smith'@'localhost' | def | test | INDEX | NO | | 'Adam Smith'@'localhost' | def | test | ALTER | NO | | 'Adam Smith'@'localhost' | def | test | CREATE TEMPORARY TABLES | NO | | 'Adam Smith'@'localhost' | def | test | LOCK TABLES | NO | | 'Adam Smith'@'localhost' | def | test | EXECUTE | NO | | 'Adam Smith'@'localhost' | def | test | CREATE VIEW | NO | | 'Adam Smith'@'localhost' | def | test | SHOW VIEW | NO | | 'Adam Smith'@'localhost' | def | test | CREATE ROUTINE | NO | | 'Adam Smith'@'localhost' | def | test | ALTER ROUTINE | NO | | 'Adam Smith'@'localhost' | def | test | EVENT | NO | | 'Adam Smith'@'localhost' | def | test | TRIGGER | NO | | 'David'@'localhost' | def | test | SELECT | NO | | 'David'@'localhost' | def | test | INSERT | NO | | 'David'@'localhost' | def | test | UPDATE | NO | | 'David'@'localhost' | def | test | DELETE | NO | | 'David'@'localhost' | def | test | CREATE | NO | | 'David'@'localhost' | def | test | REFERENCES | NO | | 'David'@'localhost' | def | test | ALTER | NO | | 'mysql.session'@'localhost' | def | performance_schema | SELECT | NO | | 'Robert'@'%' | def | sample | SELECT | YES | | 'Robert'@'%' | def | sample | INSERT | YES | | 'Robert'@'%' | def | sample | UPDATE | YES | | 'Robert'@'%' | def | sample | DELETE | YES | | 'Robert'@'%' | def | sample | CREATE | YES | | 'Robert'@'%' | def | sample | DROP | YES | | 'Robert'@'%' | def | sample | REFERENCES | YES | | 'Robert'@'%' | def | sample | INDEX | YES | | 'Robert'@'%' | def | sample | ALTER | YES | | 'Robert'@'%' | def | sample | CREATE TEMPORARY TABLES | YES | | 'Robert'@'%' | def | sample | LOCK TABLES | YES | | 'Robert'@'%' | def | sample | EXECUTE | YES | | 'Robert'@'%' | def | sample | CREATE VIEW | YES | | 'Robert'@'%' | def | sample | SHOW VIEW | YES | | 'Robert'@'%' | def | sample | CREATE ROUTINE | YES | | 'Robert'@'%' | def | sample | ALTER ROUTINE | YES | | 'Robert'@'%' | def | sample | EVENT | YES | | 'Robert'@'%' | def | sample | TRIGGER | YES | | 'Robert'@'%' | def | web | EXECUTE | NO | +-----------------------------+---------------+--------------------+-------------------------+--------------+ 46 rows in set (0.00 sec)
Advertisements