Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 989
Flash Avatar asked Jul 09 '13 10:07

Flash


1 Answers

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.

like image 199
Toddius Zho Avatar answered Sep 27 '22 01:09

Toddius Zho