Skip to content

If you’re a database administrator for MySQL, you probably want to remove user access rights to database objects from time to time. This guide covers how to do so.

Understanding MySQL privileges

MySQL manages access through a set of privileges that define what a user can and cannot do. These privileges include actions like SELECT, INSERT, UPDATE, DELETE, and more, applicable at different levels such as global, database, table, column, or routine.

Identifying privileges to revoke

Before revoking privileges, use the SHOW GRANTS command to review a user’s current privileges.

SHOW GRANTS FOR 'username'@'host';

Replace username and host with the specific user account and host details.

Revoking global privileges

To revoke global privileges, use the REVOKE statement. Global privileges are revoked from the mysql.user table.

REVOKE ALL PRIVILEGES ON *.* FROM 'username'@'host';

Revoking database-level privileges

Database-level privileges are revoked from the mysql.db table. Specify the database name in the query.

REVOKE ALL PRIVILEGES ON `database_name`.* FROM 'username'@'host';

Revoking table-level privileges

To remove privileges on a specific table, mention the database and table name.

REVOKE ALL PRIVILEGES ON `database_name`.`table_name` FROM 'username'@'host';

Revoking column-level privileges

Column-level privileges are removed by specifying the database, table, and column.

REVOKE ALL PRIVILEGES ON `database_name`.`table_name`(`column_name`) FROM 'username'@'host';

Revoking routine-level privileges

For stored routines like procedures and functions, specify the routine type and name.

REVOKE EXECUTE ON PROCEDURE `database_name`.`procedure_name` FROM 'username'@'host';

Flushing privileges

After revoking privileges, run the FLUSH PRIVILEGES command to reload the privilege tables and apply changes immediately.

FLUSH PRIVILEGES;

Monitoring and adjusting user privileges

Regularly monitor user privileges and adjust them as needed. This ensures that users have only the necessary privileges, enhancing database security.


For access management workflows, Basedash complements SQL controls with governed reporting, shared visibility, and AI-assisted analysis so teams can monitor permission changes without losing auditability.

Written by

Robert Cooper avatar

Robert Cooper

Senior Engineer at Basedash

Robert Cooper is a senior engineer at Basedash who builds full-stack product systems across SQL data infrastructure, APIs, and frontend architecture. His work focuses on application performance, developer velocity, and reliable self-hosted workflows that make data operations easier for teams at scale.

View full author profile →

Looking for an AI-native BI tool?

Basedash lets you build charts, dashboards, and reports in seconds using all your data.