Preamble
In MySQL, you can use the SHOW GRANTS statement to display all grant information for the user. This will display the privileges that have been assigned to the user with the GRANT command.
Syntax of SHOW GRANTS statement in MySQL
SHOW GRANTS [ FOR username ]
Statement parameters and arguments
- user_name – the name of the database account for which grant-information shall be displayed.
Note:
- To view user privileges (i.e. not CURRENT_USER), you must have the SELECT privilege in your MySQL database.
An example of using SHOW GRANTS command in MySQL to display grant information for a user
SHOW GRANTS FOR 'trizar';
In this example, you will see all grant information for a user called ‘trizar’. Each line returned by the SHOW GRANTS command is a GRANT operator that can be used to recreate privileges. This is a great way to capture the privileges that you want to save later.
In this first example, when you don’t specify a host for a username, MySQL accepts % as the host, so the above example is equivalent to the next SHOW GRANTS command.
For example:
SHOW GRANTS FOR 'trizar@'%';
Now let’s look at an example of using the SHOW GRANTS command when we want to specify a host.
For example:
SHOW GRANTS FOR 'trizar'@'localhost';
This example SHOW GRANTS will return grant information to a user named ‘trizar’ on the host ‘localhost’.
MySQL; Create, Delete User Accounts and Grant Privileges (create/drop user, grant, show grants)
About Enteros
Enteros offers a patented database performance management SaaS platform. It proactively identifies root causes of complex business-impacting database scalability and performance issues across a growing number of clouds, RDBMS, NoSQL, and machine learning database platforms.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
How Enteros Leverages SQL AI for Database Performance Management in the Healthcare Sector: Driving Innovation, Compliance, and Efficiency
- 21 August 2025
- Database Performance Management
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…
How Enteros’ Performance Management Platform Transforms Database Software in the Manufacturing Sector with AIOps
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…
How Enteros Uses AI-Driven Root Cause Analysis and Statistical AI on an AIOps Platform to Transform Database Performance in the Energy Sector
- 20 August 2025
- Database Performance Management
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…
How Enteros Uses Advanced AI for FinOps and Cloud Cost Estimation to Optimize Database Performance in the Banking Sector
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…