Flash
Flash

Reputation: 16703

Permission to drop views but not drop tables

I want to create a user with permission to create and drop views but not drop tables or databases. This is so I can play around when testing my views without the risk of accidentally deleting a table.

There is a GRANT CREATE VIEW privilege but there doesn't appear to be a GRANT DROP VIEW counterpart. GRANT DROP apparently applies to databases, tables and views.

Is this possible in MySQL?

Upvotes: 9

Views: 4469

Answers (1)

Toddius Zho
Toddius Zho

Reputation: 624

I've been researching this, too, and the answer appears to be No. You can restrict the DROP to only tables/views within one database (or a group of LIKE pattern-matched databases). This will make sure they cannot drop the entire database. Unfortunately, you cannot do pattern-matching on the table/view names. It's either all the tables/views (*) in those databases, or only explicity mentioned tables/views.

Upvotes: 9

Related Questions