EveRegalado
EveRegalado

Reputation: 115

MySQL: remove a user's permission to delete specific tables

That is the question... I have 30 tables in a database, and I want to avoid deleting information in five tables.

With this I will also understand how to avoid inserting in three tables. Of course, I have created a new user and still don't have any privilege.

Can this mechanic be done?

Upvotes: 1

Views: 1626

Answers (1)

nbk
nbk

Reputation: 49385

Use REVOKE:

REVOKE DELETE ON contacts FROM 'user1'@'localhost';

Which would remove the DELETE permission on table contacts.

With mydb.*, for example, you can remove all DELETE permissions on all tables in the database mydb.

Upvotes: 4

Related Questions