How to Revoke Privileges from a MySQL User

May 9, 2023 / MySQL

This article explains how cPanel users can revoke database privileges from a MySQL user using either the cPanel interface or the MySQL command line.

Method 1: Revoke Privileges via cPanel (Recommended)

  1. Log in to cPanel.
  2. Navigate to Databases > Manage My Database.
    manage my database
  3. Scroll down to Current Databases.
  4. Locate the database and click the Privileged Users.
    privileged users
  5. You will be redirected to Manage User privileges and uncheck the privileges you want to remove (e.g., SELECT, INSERT, UPDATE, DELETE).
  6. Click Make Changes.
    privileges

The selected privileges are immediately revoked.

Method 2: Revoke Privileges Using MySQL (Advanced)

  1. Open cPanel > Terminal or connect via SSH.
  2. Log in to MySQL:
    mysql -u root -

    (or use your database user credentials if not root)

  3. Revoke specific privileges from a user:
    REVOKE SELECT, INSERT, UPDATE ON database_name.* FROM 'db_user'@'localhost';
    FLUSH PRIVILEGES;
    Exit MySQL:
    EXIT;

Verify User Privileges
To confirm the current privileges for a user:

SHOW GRANTS FOR 'db_user'@'localhost';

Notes

  1. Database and user names in cPanel are usually prefixed (e.g., cpaneluser_dbname).
  2. Revoking privileges does not delete the user or database.
  3. Changes take effect immediately.

Using the cPanel interface is the safest and easiest way to revoke MySQL privileges. The command-line method is recommended only for advanced users or for automation tasks.

If you have any questions, contact our support team.

Spread the love