Search code examples
mysqlprivilegessql-revoke

Revoke Delete privilege (There is no such grant defined for user)


I am trying to revoke the Delete on mysql user

I used this code

  REVOKE DELETE
   ON *.*
   FROM 'sample_user'@'%';

But this returns me something like this

Error Code: 1141. There is no such grant defined for user

Is it possible to revoke it? Currently I have this privileges

 GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW 
  DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, 
 CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CR...

I just want to remove the Delete Privilege


Solution

  • It looks like you applied the All privileges permissions at the database.* level. You cannot only Revoke privileges at the database.* level as the All privileges was not simply carried down to the individual tables.

    Try to wiped privileges at the database level all together. And then, you able to Grant and Revoke them on a table basis.

    The effect of REVOKE statement depends on the privilege level:

    Global level
    The changes take effect when the user account connects to the MySQL Server in the subsequent sessions. The changes are not applied to all currently connected users.

    Database level
    The changes take effect after the next USE statement.

    Table and column levels
    The changes take effect on all subsequent queries.